Commit 2b0bf748 authored by Vincent Pelletier's avatar Vincent Pelletier

When unregistering a connection, remove it also from the list of connection having pending packets.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1222 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bd2a6171
...@@ -106,6 +106,12 @@ class SelectEventManager(object): ...@@ -106,6 +106,12 @@ class SelectEventManager(object):
self.connection_dict[conn.getConnector()] = conn self.connection_dict[conn.getConnector()] = conn
def unregister(self, conn): def unregister(self, conn):
new_pending_processing = [x for x in self._pending_processing
if x is not conn]
# Check that we removed at most one entry from
# self._pending_processing .
assert len(new_pending_processing) > len(self._pending_processing) - 2
self._pending_processing = new_pending_processing
del self.connection_dict[conn.getConnector()] del self.connection_dict[conn.getConnector()]
def _getPendingConnection(self): def _getPendingConnection(self):
...@@ -229,6 +235,12 @@ class EpollEventManager(object): ...@@ -229,6 +235,12 @@ class EpollEventManager(object):
self.epoll.register(fd) self.epoll.register(fd)
def unregister(self, conn): def unregister(self, conn):
new_pending_processing = [x for x in self._pending_processing
if x is not conn]
# Check that we removed at most one entry from
# self._pending_processing .
assert len(new_pending_processing) > len(self._pending_processing) - 2
self._pending_processing = new_pending_processing
fd = conn.getConnector().getDescriptor() fd = conn.getConnector().getDescriptor()
self.epoll.unregister(fd) self.epoll.unregister(fd)
del self.connection_dict[fd] del self.connection_dict[fd]
......
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