mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
IRCNetwork: run _run_autoconnect in a thread so it doesn't block whatever calls disconnect()
This commit is contained in:
parent
30bcd8ca79
commit
8100a4cea6
10
classes.py
10
classes.py
@ -1508,8 +1508,14 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
|
||||
self._buffer = b''
|
||||
self._post_disconnect()
|
||||
|
||||
if self._run_autoconnect():
|
||||
self.connect()
|
||||
def _reconnect():
|
||||
# _run_autoconnect() will block and return True after the autoconnect
|
||||
# delay has passed, if autoconnect is disabled. (We do not want it to
|
||||
# block whatever is calling disconnect() though.)
|
||||
if self._run_autoconnect():
|
||||
self.connect()
|
||||
t = threading.Thread(target=_reconnect, name="Reconnecting network %s" % self.name)
|
||||
t.start()
|
||||
|
||||
def handle_events(self, line):
|
||||
raise NotImplementedError
|
||||
|
Loading…
Reference in New Issue
Block a user