parent
073dea6745
commit
8ed9275a26
1 changed files with 15 additions and 1 deletions
|
@ -101,6 +101,7 @@ class WebSocket(threading.Thread):
|
||||||
log.info("----===## Starting WebSocketClient ##===----")
|
log.info("----===## Starting WebSocketClient ##===----")
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
|
handshake_counter = 0
|
||||||
threadStopped = self.threadStopped
|
threadStopped = self.threadStopped
|
||||||
threadSuspended = self.threadSuspended
|
threadSuspended = self.threadSuspended
|
||||||
while not threadStopped():
|
while not threadStopped():
|
||||||
|
@ -148,13 +149,26 @@ class WebSocket(threading.Thread):
|
||||||
log.info("timeout while connecting, trying again")
|
log.info("timeout while connecting, trying again")
|
||||||
self.ws = None
|
self.ws = None
|
||||||
xbmc.sleep(1000)
|
xbmc.sleep(1000)
|
||||||
|
except websocket.WebSocketException as e:
|
||||||
|
log.info('WebSocketException: %s' % e)
|
||||||
|
if 'Handshake Status 401' in e.args:
|
||||||
|
handshake_counter += 1
|
||||||
|
if handshake_counter >= 5:
|
||||||
|
log.info('Error in handshake detected. Stopping '
|
||||||
|
'WebSocketClient now')
|
||||||
|
break
|
||||||
|
self.ws = None
|
||||||
|
xbmc.sleep(1000)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("Unknown exception encountered in connecting: %s"
|
log.error("Unknown exception encountered in connecting: %s"
|
||||||
% e)
|
% e)
|
||||||
|
import traceback
|
||||||
|
log.error("Traceback:\n%s" % traceback.format_exc())
|
||||||
self.ws = None
|
self.ws = None
|
||||||
xbmc.sleep(1000)
|
xbmc.sleep(1000)
|
||||||
else:
|
else:
|
||||||
counter = 0
|
counter = 0
|
||||||
|
handshake_counter = 0
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("Unknown exception encountered: %s" % e)
|
log.error("Unknown exception encountered: %s" % e)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue