mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21: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:
parent
c01b449741
commit
9fde35fd77
@ -222,10 +222,13 @@ def getRemoteSid(irc, remoteirc):
|
|||||||
desc="PyLink Relay network - %s" %
|
desc="PyLink Relay network - %s" %
|
||||||
(remoteirc.serverdata.get('netname')\
|
(remoteirc.serverdata.get('netname')\
|
||||||
or remoteirc.name), endburst_delay=3)
|
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:',
|
log.exception('(%s) Failed to spawn server for %r:',
|
||||||
irc.name, remoteirc.name)
|
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:
|
else:
|
||||||
irc.servers[sid].remote = remoteirc.name
|
irc.servers[sid].remote = remoteirc.name
|
||||||
relayservers[irc.name][remoteirc.name] = sid
|
relayservers[irc.name][remoteirc.name] = sid
|
||||||
|
Loading…
Reference in New Issue
Block a user