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
@ -1508,8 +1508,14 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
|
|||||||
self._buffer = b''
|
self._buffer = b''
|
||||||
self._post_disconnect()
|
self._post_disconnect()
|
||||||
|
|
||||||
|
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():
|
if self._run_autoconnect():
|
||||||
self.connect()
|
self.connect()
|
||||||
|
t = threading.Thread(target=_reconnect, name="Reconnecting network %s" % self.name)
|
||||||
|
t.start()
|
||||||
|
|
||||||
def handle_events(self, line):
|
def handle_events(self, line):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
Loading…
Reference in New Issue
Block a user