3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +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,14 +37,15 @@ def initialize_all(irc):
# which would break connections.
if world.started.wait(TCONDITION_TIMEOUT):
for chanpair, entrydata in db.items():
# Iterate over all the channels stored in our relay links DB.
network, channel = chanpair
# Initialize each relay channel on their home network, and on every linked one too.
initialize_channel(irc, channel)
# 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)
for link in entrydata['links']:
network, channel = link
initialize_channel(irc, channel)
if network == irc.name:
initialize_channel(irc, channel)
def main(irc=None):
"""Main function, called during plugin loading at start."""