Commit 14021964 authored by Vincent Pelletier's avatar Vincent Pelletier

Make Connection.isClosed return True on aborted connections.

The only difference between an aborted connection and a closed one is that
packets sent just before aborting are pushed to the network before really
closing the connection. But further sends must fail, and nothing should be
received.
parent ef8f00ca
......@@ -329,7 +329,7 @@ class BaseConnection(object):
return None
def isClosed(self):
return self.connector is None
return self.connector is None or self.isAborted()
def isAborted(self):
return False
......
......@@ -122,8 +122,7 @@ class EventHandler(object):
# Packet handlers.
def ping(self, conn):
if not conn.isAborted():
conn.answer(Packets.Pong())
conn.answer(Packets.Pong())
def pong(self, conn):
# Ignore PONG packets. The only purpose of ping/pong packets is
......
......@@ -354,7 +354,7 @@ class Application(object):
event_queue_dict[key] -= 1
if event_queue_dict[key] == 0:
del event_queue_dict[key]
if conn.isAborted() or conn.isClosed():
if conn.isClosed():
continue
orig_msg_id = conn.getPeerId()
conn.setPeerId(msg_id)
......
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