3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 13:42:37 +01:00

NetworkCore: set self.aborted to True as early as possible when launching a disconnect

This should prevent spurious "No data received" errors from popping up when using the 'disconnect' command.
This commit is contained in:
James Lu 2017-07-12 22:07:42 -07:00
parent f85bdb3d8b
commit 0e3d733a72

View File

@ -375,6 +375,7 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
return
def _pre_disconnect(self):
self.aborted.set()
self.was_successful = self.connected.is_set()
log.debug('(%s) _pre_disconnect: got %s for was_successful state', self.name, self.was_successful)
@ -386,8 +387,6 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
log.removeHandler(self.loghandlers.pop())
def _post_disconnect(self):
log.debug('(%s) _post_disconnect: Setting self.aborted to True.', self.name)
self.aborted.set()
# Internal hook signifying that a network has disconnected.
self.call_hooks([None, 'PYLINK_DISCONNECT', {'was_successful': self.was_successful}])