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,11 +180,9 @@ class HandlerSwitcher(object): ...@@ -180,11 +180,9 @@ 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)
if not connection.isClosed():
notification = Packets.Notify('Unexpected answer: %r' % packet) notification = Packets.Notify('Unexpected answer: %r' % packet)
try:
connection.notify(notification) connection.notify(notification)
except ConnectorConnectionClosedException:
pass
connection.abort() 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
...@@ -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