From 1a18c810d0b5c53201508f81b5f947b46cce78ae Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sat, 5 Nov 2016 16:28:59 +0100 Subject: [PATCH] Close Plex companion connection on exceptions - Fixes #137 --- resources/lib/plexbmchelper/httppersist.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/lib/plexbmchelper/httppersist.py b/resources/lib/plexbmchelper/httppersist.py index 0fdf61bb..e765ae9e 100644 --- a/resources/lib/plexbmchelper/httppersist.py +++ b/resources/lib/plexbmchelper/httppersist.py @@ -62,6 +62,14 @@ class RequestMgr: if conn: conn.close() return False + except Exception as e: + log.error("Exception encountered: %s" % e) + # Close connection just in case + try: + conn.close() + except: + pass + return False def getwithparams(self, host, port, path, params, header={}, protocol="http"):