Commit f24034f7 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Do not register too many times a writable connector.

The connection may have been already added to writable events in poll, it
usefull to add it here only if the buffer was initialy empty.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1704 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1a18b15e
...@@ -360,11 +360,13 @@ class Connection(BaseConnection): ...@@ -360,11 +360,13 @@ class Connection(BaseConnection):
if self.connector is None: if self.connector is None:
return return
was_empty = not bool(self.write_buf)
PACKET_LOGGER.dispatch(self, packet, ' to ') PACKET_LOGGER.dispatch(self, packet, ' to ')
self.write_buf += packet() self.write_buf += packet()
# If this is the first time, enable polling for writing. if was_empty:
if self.write_buf: # enable polling for writing.
self.em.addWriter(self) self.em.addWriter(self)
def expectMessage(self, msg_id=None, timeout=5, additional_timeout=30): def expectMessage(self, msg_id=None, timeout=5, additional_timeout=30):
......
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