Commit 98b6210c authored by Vincent Pelletier's avatar Vincent Pelletier

Do not send error on closed connection.

parent 300e2023
...@@ -54,25 +54,30 @@ class EventHandler(object): ...@@ -54,25 +54,30 @@ class EventHandler(object):
args = packet.decode() or () args = packet.decode() or ()
method(conn, *args, **kw) method(conn, *args, **kw)
except UnexpectedPacketError, e: except UnexpectedPacketError, e:
self.__unexpectedPacket(conn, packet, *e.args) if not conn.isClosed():
self.__unexpectedPacket(conn, packet, *e.args)
except PacketMalformedError: except PacketMalformedError:
neo.lib.logging.error('malformed packet from %r', conn) if not conn.isClosed():
conn.notify(Packets.Notify('Malformed packet: %r' % (packet, ))) neo.lib.logging.error('malformed packet from %r', conn)
conn.abort() conn.notify(Packets.Notify('Malformed packet: %r' % (packet, )))
# self.peerBroken(conn) conn.abort()
# self.peerBroken(conn)
except BrokenNodeDisallowedError: except BrokenNodeDisallowedError:
conn.answer(Errors.BrokenNode('go away')) if not conn.isClosed():
conn.abort() conn.answer(Errors.BrokenNode('go away'))
conn.abort()
except NotReadyError, message: except NotReadyError, message:
if not message.args: if not conn.isClosed():
message = 'Retry Later' if not message.args:
message = str(message) message = 'Retry Later'
conn.answer(Errors.NotReady(message)) message = str(message)
conn.abort() conn.answer(Errors.NotReady(message))
conn.abort()
except ProtocolError, message: except ProtocolError, message:
message = str(message) if not conn.isClosed():
conn.answer(Errors.ProtocolError(message)) message = str(message)
conn.abort() conn.answer(Errors.ProtocolError(message))
conn.abort()
def checkClusterName(self, name): def checkClusterName(self, name):
# raise an exception if the given name mismatch the current cluster name # raise an exception if the given name mismatch the current cluster name
......
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