3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-26 04:32:51 +01:00

Set Irc.aborted earlier in the disconnect loop

This prevents plugins from getting really confused as we remove things.
This commit is contained in:
James Lu 2017-08-03 10:22:57 -07:00
parent 0d5afd266f
commit a0a295f7d2

View File

@ -390,6 +390,9 @@ class Irc(utils.DeprecatedAttributesObject):
log.debug('(%s) disconnect: Clearing self.connected state.', self.name) log.debug('(%s) disconnect: Clearing self.connected state.', self.name)
self.connected.clear() self.connected.clear()
log.debug('(%s) disconnect: Setting self.aborted to True.', self.name)
self.aborted.set()
log.debug('(%s) Removing channel logging handlers due to disconnect.', self.name) log.debug('(%s) Removing channel logging handlers due to disconnect.', self.name)
while self.loghandlers: while self.loghandlers:
log.removeHandler(self.loghandlers.pop()) log.removeHandler(self.loghandlers.pop())
@ -412,9 +415,6 @@ class Irc(utils.DeprecatedAttributesObject):
log.debug('(%s) Canceling pingTimer at %s due to disconnect() call', self.name, time.time()) log.debug('(%s) Canceling pingTimer at %s due to disconnect() call', self.name, time.time())
self.pingTimer.cancel() self.pingTimer.cancel()
log.debug('(%s) 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.callHooks([None, 'PYLINK_DISCONNECT', {'was_successful': was_successful}]) self.callHooks([None, 'PYLINK_DISCONNECT', {'was_successful': was_successful}])