Change logic for server online

Removed server offline from websocket. At least, until we can figure out
why the websocket constantly disconnect from the server for some users.
This commit is contained in:
angelblue05 2015-06-04 05:37:10 -05:00
parent 3954c50329
commit 5f7f08079c

View file

@ -310,13 +310,14 @@ class WebSocketThread(threading.Thread):
WINDOW = self.WINDOW WINDOW = self.WINDOW
self.logMsg("Closed", 2) self.logMsg("Closed", 2)
# Server is not online # Server is not online
if WINDOW.getProperty("Server_online") == "true": '''if WINDOW.getProperty("Server_online") == "true":
self.logMsg("Server is unreachable.", 1) self.logMsg("Server is unreachable.", 1)
WINDOW.setProperty("Server_online", "false") WINDOW.setProperty("Server_online", "false")
xbmcgui.Dialog().notification("Error connecting", "%s Server is unreachable." % self.addonName) xbmcgui.Dialog().notification("Error connecting", "%s Server is unreachable." % self.addonName)'''
def on_open(self, ws): def on_open(self, ws):
pass deviceId = ClientInformation().getMachineId()
self.doUtils.postCapabilities(deviceId)
def run(self): def run(self):
@ -346,17 +347,14 @@ class WebSocketThread(threading.Thread):
self.client.on_open = self.on_open self.client.on_open = self.on_open
while not self.KodiMonitor.abortRequested(): while self.keepRunning:
if WINDOW.getProperty("Server_online") == "true": self.client.run_forever()
# Server came back online, repost capabilities
self.doUtils.postCapabilities(deviceId)
self.client.run_forever()
if (self.keepRunning): if self.keepRunning:
self.logMsg("Client Needs To Restart", 2)
if self.KodiMonitor.waitForAbort(5): if self.KodiMonitor.waitForAbort(5):
break break
else: break
self.logMsg("Thread Exited") self.logMsg("Thread Exited", 1)