Add tests for early and outgoing packet listeners.

This commit is contained in:
joo committed 2017-08-22 17:50:16 +01:00
1 parent 9497aae8fa
commit b79e7b5f28
3 files changed
+161 -14

No files matched your search

+7 -2
View File
@@ -315,8 +315,13 @@ class Connection(object):
def disconnect(self):
""" Terminate the existing server connection, if there is one. """
if self.networking_thread is not None:
with self._write_lock: # pylint: disable=not-context-manager
with self._write_lock: # pylint: disable=not-context-manager
if self.socket is not None:
# Flush any packets remaining in the queue.
while self._pop_packet():
pass
if self.networking_thread is not None:
self.networking_thread.interrupt = True
if self.socket is not None: