- commit
- 3cc11dd4392bec713c494075088c0f0f67aee8c3
- parent
- 8f00eb7b2b6fc1379571317625d81aeb50ed22b4
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2014-10-18 08:36
pass loop to client
Diffstat
| M | laneya/client.py | 6 | +++--- |
| M | laneya/protocol.py | 5 | +++-- |
2 files changed, 6 insertions, 5 deletions
diff --git a/laneya/client.py b/laneya/client.py
@@ -11,8 +11,8 @@ screen.border() 11 11 12 12 13 13 class Client(protocol.ClientProtocolFactory):14 -1 def __init__(self):15 -1 protocol.ClientProtocolFactory.__init__(self)-1 14 def __init__(self, loop): -1 15 super(Client, self).__init__(loop) 16 16 self.position_x = 0 17 17 self.position_y = 0 18 18 @@ -40,7 +40,7 @@ class Client(protocol.ClientProtocolFactory): 40 40 elif event['key'] == ord('q'): 41 41 self.send_request('logout') 42 42 screen.cleanup()43 -1 reactor.stop()-1 43 self.loop.close() 44 44 45 45 46 46 def main():
diff --git a/laneya/protocol.py b/laneya/protocol.py
@@ -328,8 +328,8 @@ class ClientProtocol(BaseProtocol): 328 328 self.send_json(data) 329 329 330 330 d = q.Deferred()331 -1 reactor.callLater(2, lambda: self._timeout(d, data['key']))332 331 self._response_deferreds[data['key']] = d -1 332 self.factory.loop.call_later(2, self._timeout, d, data['key']) 333 333 return d.promise 334 334 335 335 @@ -339,7 +339,8 @@ class ClientProtocolFactory(Factory): 339 339 We assume that this factory has only one active connection. 340 340 """ 341 341342 -1 def __init__(self):-1 342 def __init__(self, loop): -1 343 self.loop = loop 343 344 self.connections = [] 344 345 345 346 def build_protocol(self):