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

IRCNetwork: error when attempting to start multiple connection threads for a network

This commit is contained in:
James Lu 2017-06-27 15:58:55 -07:00
parent c3cdf63253
commit 62784a63e4

View File

@ -1294,6 +1294,9 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
# HACK: Don't thread if we're running tests. # HACK: Don't thread if we're running tests.
self._connect() self._connect()
else: else:
if self.connection_thread and self.connection_thread.is_alive():
raise RuntimeError("Refusing to start multiple connection threads for network %r!" % self.name)
self.connection_thread = threading.Thread(target=self._connect, self.connection_thread = threading.Thread(target=self._connect,
name="Listener for %s" % name="Listener for %s" %
self.name) self.name)