mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
relay: make handle_quit error-tolerant if the target is missing
In cases where multiple networks disconnect simultaneously, the relay user for a quitting client from the first dying network might have also disappeared while handle_disconnect was processing the disconnection of a second dying network. This should take into account those situations.
This commit is contained in:
parent
54987fde4e
commit
bb8a548e74
@ -811,10 +811,15 @@ def handle_join(irc, numeric, command, args):
|
||||
utils.add_hook(handle_join, 'JOIN')
|
||||
|
||||
def handle_quit(irc, numeric, command, args):
|
||||
# Lock the user spawning mechanism before proceeding, since we're going to be
|
||||
# deleting client from the relayusers cache.
|
||||
with spawnlocks[irc.name]:
|
||||
for netname, user in relayusers[(irc.name, numeric)].copy().items():
|
||||
remoteirc = world.networkobjects[netname]
|
||||
remoteirc.proto.quit(user, args['text'])
|
||||
try: # Try to quit the client. If this fails because they're missing, bail.
|
||||
remoteirc.proto.quit(user, args['text'])
|
||||
except LookupError:
|
||||
pass
|
||||
del relayusers[(irc.name, numeric)]
|
||||
|
||||
utils.add_hook(handle_quit, 'QUIT')
|
||||
|
Loading…
Reference in New Issue
Block a user