3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

Irc: explicitly kill connect loop threads after an Irc object has been removed

Possible fix for #351.
This commit is contained in:
James Lu 2016-11-02 22:34:02 -07:00
parent e977c95520
commit 6ad40c91b4

View File

@ -180,6 +180,7 @@ class Irc():
__init__ in a separate thread to allow multiple concurrent connections.
"""
while True:
self.aborted.clear()
self.initVars()
@ -326,6 +327,11 @@ class Irc():
if autoconnect is not None and autoconnect >= 1:
log.info('(%s) Going to auto-reconnect in %s seconds.', self.name, autoconnect)
time.sleep(autoconnect)
if self not in world.networkobjects.values():
log.debug('Stopping stale connect loop for old connection %r', self.name)
return
else:
log.info('(%s) Stopping connect loop (autoconnect value %r is < 1).', self.name, autoconnect)
return