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

relay: only initialize channels that are relevant to the called network in initialize_all()

Previously, this would quite often hit channel names that simply don't exist on the target network.
This commit is contained in:
James Lu 2017-07-07 14:10:06 -07:00
parent 3b091f9e20
commit f7dfc38688

View File

@ -37,13 +37,14 @@ def initialize_all(irc):
# which would break connections. # which would break connections.
if world.started.wait(TCONDITION_TIMEOUT): if world.started.wait(TCONDITION_TIMEOUT):
for chanpair, entrydata in db.items(): for chanpair, entrydata in db.items():
# Iterate over all the channels stored in our relay links DB.
network, channel = chanpair network, channel = chanpair
# Initialize each relay channel on their home network, and on every linked one too. # Initialize all channels that are relevant to the called network (i.e. channels either hosted there or a relay leaf channels)
if network == irc.name:
initialize_channel(irc, channel) initialize_channel(irc, channel)
for link in entrydata['links']: for link in entrydata['links']:
network, channel = link network, channel = link
if network == irc.name:
initialize_channel(irc, channel) initialize_channel(irc, channel)
def main(irc=None): def main(irc=None):