Commit f9b5cea4 authored by Julien Muchembled's avatar Julien Muchembled

Do not try to send notifications on closed connections

Now we can assert that abort is not called when it shouldn't be.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2728 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 81cbbeeb
......@@ -180,12 +180,10 @@ class HandlerSwitcher(object):
else:
neo.lib.logging.error(
'Unexpected answer %r in %r', packet, connection)
notification = Packets.Notify('Unexpected answer: %r' % packet)
try:
if not connection.isClosed():
notification = Packets.Notify('Unexpected answer: %r' % packet)
connection.notify(notification)
except ConnectorConnectionClosedException:
pass
connection.abort()
connection.abort()
handler.peerBroken(connection)
# apply a pending handler if no more answers are pending
while len(self._pending) > 1 and not self._pending[0][0]:
......@@ -476,6 +474,7 @@ class Connection(BaseConnection):
"""Abort dealing with this connection."""
neo.lib.logging.debug('aborting a connector for %r', self)
self.aborted = True
assert self.write_buf
def writable(self):
"""Called when self is writable."""
......
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