3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

launcher: prevent protocol module init errors from aborting execution

This fixes various issues including:
- Networks going missing (the server list is read in a non-deterministic order)
- world.started never being set, causing relay to never work!
This commit is contained in:
James Lu 2018-02-10 16:17:18 -08:00
parent 3f7e2328fe
commit 8321485315

View File

@ -139,12 +139,17 @@ def main():
log.error("(%s) Configuration error: No protocol module specified, aborting.", network) log.error("(%s) Configuration error: No protocol module specified, aborting.", network)
else: else:
# Fetch the correct protocol module. # Fetch the correct protocol module.
proto = utils.getProtocolModule(protoname) try:
proto = utils.getProtocolModule(protoname)
# Create and connect the network. # Create and connect the network.
world.networkobjects[network] = irc = proto.Class(network) world.networkobjects[network] = irc = proto.Class(network)
log.debug('Connecting to network %r', network) log.debug('Connecting to network %r', network)
irc.connect() irc.connect()
except:
log.exception('(%s) Failed to connect to network %r, skipping it...',
network, network)
continue
world.started.set() world.started.set()
log.info("Loaded plugins: %s", ', '.join(sorted(world.plugins.keys()))) log.info("Loaded plugins: %s", ', '.join(sorted(world.plugins.keys())))