3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 12:12:53 +01:00

classes.Irc: clear state on disconnect, not on connect

Possible fix for #183 - when networks disconnect, their server index wasn't cleared properly, causing errors from servers already existing to be thrown when the same server name is spawned again.
This commit is contained in:
James Lu 2016-03-25 14:59:07 -07:00
parent 1930739aad
commit 2b16f25b61

View File

@ -165,7 +165,6 @@ class Irc():
__init__ in a separate thread to allow multiple concurrent connections. __init__ in a separate thread to allow multiple concurrent connections.
""" """
while True: while True:
self.initVars()
ip = self.serverdata["ip"] ip = self.serverdata["ip"]
port = self.serverdata["port"] port = self.serverdata["port"]
checks_ok = True checks_ok = True
@ -299,6 +298,9 @@ class Irc():
log.debug('(%s) _disconnect: Setting self.aborted to True.', self.name) log.debug('(%s) _disconnect: Setting self.aborted to True.', self.name)
self.aborted.set() self.aborted.set()
log.debug('(%s) disconnect: Clearing state via initVars().', self.name)
self.initVars()
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())