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): ...@@ -329,7 +329,7 @@ class BaseConnection(object):
return None return None
def isClosed(self): def isClosed(self):
return self.connector is None return self.connector is None or self.isAborted()
def isAborted(self): def isAborted(self):
return False return False
......
...@@ -122,8 +122,7 @@ class EventHandler(object): ...@@ -122,8 +122,7 @@ class EventHandler(object):
# Packet handlers. # Packet handlers.
def ping(self, conn): def ping(self, conn):
if not conn.isAborted(): conn.answer(Packets.Pong())
conn.answer(Packets.Pong())
def pong(self, conn): def pong(self, conn):
# Ignore PONG packets. The only purpose of ping/pong packets is # Ignore PONG packets. The only purpose of ping/pong packets is
......
...@@ -354,7 +354,7 @@ class Application(object): ...@@ -354,7 +354,7 @@ class Application(object):
event_queue_dict[key] -= 1 event_queue_dict[key] -= 1
if event_queue_dict[key] == 0: if event_queue_dict[key] == 0:
del event_queue_dict[key] del event_queue_dict[key]
if conn.isAborted() or conn.isClosed(): if conn.isClosed():
continue continue
orig_msg_id = conn.getPeerId() orig_msg_id = conn.getPeerId()
conn.setPeerId(msg_id) 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