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

relay: handle server name conflicts more correctly

1) Clear the relay servers cache
2) Disconnect
3) Raise a proper exception so other parts of relay don't carry on with undefined behaviour
This commit is contained in:
James Lu 2016-04-02 12:46:45 -07:00
parent c01b449741
commit 9fde35fd77

View File

@ -222,10 +222,13 @@ def getRemoteSid(irc, remoteirc):
desc="PyLink Relay network - %s" %
(remoteirc.serverdata.get('netname')\
or remoteirc.name), endburst_delay=3)
except ValueError: # Network not initialized yet.
except ValueError: # Network not initialized yet, or a server name conflict.
log.exception('(%s) Failed to spawn server for %r:',
irc.name, remoteirc.name)
return
# We will just bail here. Disconnect the bad network.
handle_disconnect(irc, None, 'PYLINK_DISCONNECT_RELAY_FORCED', {})
irc.disconnect()
raise
else:
irc.servers[sid].remote = remoteirc.name
relayservers[irc.name][remoteirc.name] = sid