Commit 87da8390 authored by Vincent Pelletier's avatar Vincent Pelletier

Factorise addReader calls.

parent a870a8ef
...@@ -256,6 +256,7 @@ class BaseConnection(object): ...@@ -256,6 +256,7 @@ class BaseConnection(object):
self.addr = addr self.addr = addr
self._handlers = HandlerSwitcher(handler) self._handlers = HandlerSwitcher(handler)
event_manager.register(self) event_manager.register(self)
event_manager.addReader(self)
getHandler = property(lambda self: self._handlers.getHandler) getHandler = property(lambda self: self._handlers.getHandler)
getLastHandler = property(lambda self: self._handlers.getLastHandler) getLastHandler = property(lambda self: self._handlers.getLastHandler)
...@@ -381,7 +382,6 @@ class ListeningConnection(BaseConnection): ...@@ -381,7 +382,6 @@ class ListeningConnection(BaseConnection):
BaseConnection.__init__(self, event_manager, handler, BaseConnection.__init__(self, event_manager, handler,
addr=addr, connector=connector) addr=addr, connector=connector)
self.connector.makeListeningConnection(addr) self.connector.makeListeningConnection(addr)
self.em.addReader(self)
def readable(self): def readable(self):
try: try:
...@@ -422,7 +422,6 @@ class Connection(BaseConnection): ...@@ -422,7 +422,6 @@ class Connection(BaseConnection):
self._queue = [] self._queue = []
self._on_close = None self._on_close = None
self._parser_state = ParserState() self._parser_state = ParserState()
event_manager.addReader(self)
def setOnClose(self, callback): def setOnClose(self, callback):
self._on_close = callback self._on_close = callback
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment