From 0d616fef94f44d7d4fd7336a50f2664c0d473f3f Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 11 Apr 2015 07:56:07 -0500 Subject: [PATCH] Replaced sleep with waitForAbort() Hopefully helps with the hang crash. --- resources/lib/WebSocketClient.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/lib/WebSocketClient.py b/resources/lib/WebSocketClient.py index 6a4e73ae..0c7d161d 100644 --- a/resources/lib/WebSocketClient.py +++ b/resources/lib/WebSocketClient.py @@ -11,6 +11,8 @@ import threading import urllib import socket import websocket + +import KodiMonitor from ClientInformation import ClientInformation from DownloadUtils import DownloadUtils from PlaybackUtils import PlaybackUtils @@ -26,6 +28,8 @@ class WebSocketThread(threading.Thread): keepRunning = True def __init__(self, *args): + + self.KodiMonitor = KodiMonitor.Kodi_Monitor() addonSettings = xbmcaddon.Addon(id='plugin.video.emby') level = addonSettings.getSetting('logLevel') self.logLevel = 0 @@ -286,12 +290,13 @@ class WebSocketThread(threading.Thread): self.client.on_open = self.on_open - while(self.keepRunning): + while not self.KodiMonitor.abortRequested(): self.logMsg("Client Starting") self.client.run_forever() if(self.keepRunning): self.logMsg("Client Needs To Restart") - xbmc.sleep(10000) + if self.KodiMonitor.waitForAbort(10000): + break self.logMsg("Thread Exited")