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