mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
relay: don't spam subserver connects + instant disconnects for networks that are dead
This commit is contained in:
parent
bde2f66b2a
commit
d21ce9983d
@ -1003,6 +1003,9 @@ def handle_endburst(irc, numeric, command, args):
|
|||||||
utils.add_hook(handle_endburst, "ENDBURST")
|
utils.add_hook(handle_endburst, "ENDBURST")
|
||||||
|
|
||||||
def handle_disconnect(irc, numeric, command, args):
|
def handle_disconnect(irc, numeric, command, args):
|
||||||
|
"""Handles IRC network disconnections (internal hook)."""
|
||||||
|
# Quit all of our users' representations on other nets, and remove
|
||||||
|
# them from our relay clients index.
|
||||||
for k, v in relayusers.copy().items():
|
for k, v in relayusers.copy().items():
|
||||||
if irc.name in v:
|
if irc.name in v:
|
||||||
del relayusers[k][irc.name]
|
del relayusers[k][irc.name]
|
||||||
@ -1012,11 +1015,15 @@ def handle_disconnect(irc, numeric, command, args):
|
|||||||
del relayusers[k]
|
del relayusers[k]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
# SQUIT all relay pseudoservers spawned for us, and remove them
|
||||||
|
# from our relay subservers index.
|
||||||
for name, ircobj in world.networkobjects.copy().items():
|
for name, ircobj in world.networkobjects.copy().items():
|
||||||
if name != irc.name and ircobj.connected.is_set():
|
if name != irc.name and ircobj.connected.is_set():
|
||||||
rsid = getRemoteSid(ircobj, irc)
|
try:
|
||||||
# Let's be super extra careful here...
|
rsid = relayservers[ircobj.name][irc.name]
|
||||||
if rsid and name in relayservers and irc.name in relayservers[name]:
|
except KeyError:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
ircobj.proto.squitServer(ircobj.sid, rsid, text='Home network lost connection.')
|
ircobj.proto.squitServer(ircobj.sid, rsid, text='Home network lost connection.')
|
||||||
del relayservers[name][irc.name]
|
del relayservers[name][irc.name]
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user