3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

relay: don't block on client spawning

Just fail instantly if the remote isn't ready.
This commit is contained in:
James Lu 2017-08-31 12:27:52 -07:00
parent e02393c22b
commit 450718cce6

View File

@ -217,7 +217,7 @@ def get_prefix_modes(irc, remoteirc, channel, user, mlist=None):
return modes return modes
def spawn_relay_server(irc, remoteirc): def spawn_relay_server(irc, remoteirc):
if irc.connected.wait(TCONDITION_TIMEOUT): if irc.connected.is_set():
try: try:
# ENDBURST is delayed by 3 secs on supported IRCds to prevent # ENDBURST is delayed by 3 secs on supported IRCds to prevent
# triggering join-flood protection and the like. # triggering join-flood protection and the like.
@ -358,7 +358,7 @@ def get_remote_user(irc, remoteirc, user, spawn_if_missing=True, times_tagged=0)
spawning one if it doesn't exist and spawn_if_missing is True.""" spawning one if it doesn't exist and spawn_if_missing is True."""
# Wait until the network is working before trying to spawn anything. # Wait until the network is working before trying to spawn anything.
if irc.connected.wait(TCONDITION_TIMEOUT): if irc.connected.is_set():
# Don't spawn clones for registered service bots. # Don't spawn clones for registered service bots.
sbot = irc.get_service_bot(user) sbot = irc.get_service_bot(user)
if sbot: if sbot: