Corrected disconnection on no contact with server

This commit is contained in:
Uriziel 2012-12-19 13:02:39 +01:00
parent 18e6b67621
commit 4b8469ddaa
1 changed files with 10 additions and 1 deletions

View File

@ -101,6 +101,15 @@ class SyncplayClient(object):
return
if(self._player):
self._player.askForStatus()
self.checkIfConnected()
def checkIfConnected(self):
if(self._lastGlobalUpdate and self._protocol and time.time() - self._lastGlobalUpdate > 2.5):
self._lastGlobalUpdate = None
self.ui.showErrorMessage("Connection with server timeouted")
self._protocol.drop()
return False
return True
def _determinePlayerStateChange(self, paused, position):
pauseChange = self.getPlayerPaused() != paused and self.getGlobalPaused() != paused