From 8321485315c9e83c1a45a053ec51ce81cd7977cc Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 10 Feb 2018 16:17:18 -0800 Subject: [PATCH] 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! --- launcher.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/launcher.py b/launcher.py index fcfaf6a..c3e16ae 100644 --- a/launcher.py +++ b/launcher.py @@ -139,12 +139,17 @@ def main(): log.error("(%s) Configuration error: No protocol module specified, aborting.", network) else: # Fetch the correct protocol module. - proto = utils.getProtocolModule(protoname) + try: + proto = utils.getProtocolModule(protoname) - # Create and connect the network. - world.networkobjects[network] = irc = proto.Class(network) - log.debug('Connecting to network %r', network) - irc.connect() + # Create and connect the network. + world.networkobjects[network] = irc = proto.Class(network) + log.debug('Connecting to network %r', network) + irc.connect() + except: + log.exception('(%s) Failed to connect to network %r, skipping it...', + network, network) + continue world.started.set() log.info("Loaded plugins: %s", ', '.join(sorted(world.plugins.keys())))