Fixed some messages being send prematurely

This commit is contained in:
Uriziel 2014-04-21 22:14:22 +02:00
parent fd14fd1755
commit b510f3c38e
2 changed files with 5 additions and 1 deletions

View File

@ -249,6 +249,9 @@ class SyncServerProtocol(JSONCommandProtocol):
def connectionLost(self, reason):
self._factory.removeWatcher(self._watcher)
def isLogged(self):
return self._logged
def _extractHelloArguments(self, hello):
roomName, roomPassword = None, None
username = hello["username"] if hello.has_key("username") else None

View File

@ -289,7 +289,8 @@ class Watcher(object):
self._sendStateTimer.stop()
def sendState(self, position, paused, doSeek, setBy, forcedUpdate):
self._connector.sendState(position, paused, doSeek, setBy, forcedUpdate)
if self._connector.isLogged():
self._connector.sendState(position, paused, doSeek, setBy, forcedUpdate)
if time.time() - self._lastUpdatedOn > constants.PROTOCOL_TIMEOUT:
self._server.removeWatcher(self)
self._connector.drop()