Commit 4a82657b authored by Julien Muchembled's avatar Julien Muchembled

Silently ignore answers to packets that aren't ignored on closed connection

Commits like 7eb7cf1b
("Minimize the amount of work during tpc_finish") dropped what was done in
commit 07b48079
("Ignore some requests, based on connection state") to protect request handlers
when they respond.

This commit fixes this in a generic way.
parent 8b1189d3
......@@ -576,10 +576,12 @@ class Connection(BaseConnection):
def answer(self, packet):
""" Answer to a packet by re-using its ID for the packet answer """
assert packet.isResponse(), packet
if self.isClosed():
raise ConnectionClosed
if packet.ignoreOnClosedConnection() and not packet.isError():
raise ConnectionClosed
return
packet.setId(self.peer_id)
assert packet.isResponse(), packet
self._addPacket(packet)
def idle(self):
......
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