mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +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:
parent
f85bdb3d8b
commit
0e3d733a72
@ -375,6 +375,7 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
|
|||||||
return
|
return
|
||||||
|
|
||||||
def _pre_disconnect(self):
|
def _pre_disconnect(self):
|
||||||
|
self.aborted.set()
|
||||||
self.was_successful = self.connected.is_set()
|
self.was_successful = self.connected.is_set()
|
||||||
log.debug('(%s) _pre_disconnect: got %s for was_successful state', self.name, self.was_successful)
|
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())
|
log.removeHandler(self.loghandlers.pop())
|
||||||
|
|
||||||
def _post_disconnect(self):
|
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.
|
# Internal hook signifying that a network has disconnected.
|
||||||
self.call_hooks([None, 'PYLINK_DISCONNECT', {'was_successful': self.was_successful}])
|
self.call_hooks([None, 'PYLINK_DISCONNECT', {'was_successful': self.was_successful}])
|
||||||
|
Loading…
Reference in New Issue
Block a user