Commits

Marcin Kasperski committed 9aee5b3

Stopping reactor only if it is not yet stopped

Comments (0)

Files changed (1)

src/mekk/fics/fics_connector.py

                 self.label, str(e)))
         except Exception as e:
             logger_lib.error("%s: Failure while logging in. Stopping. Failure:\n" % self.label\
-            + traceback.format_exc(e))
-            reactor.stop()
+                + traceback.format_exc(e))
+            if reactor.running:
+                reactor.stop()
 
     def on_unhandled_processing_failure(self, failure):
         """
         #TODO: delegate to client so the user code can recover from this failure
         #logger_lib.error("%s: Unhandled error, stopping program. Error details:\n%s" % (
         #    self.label, err))
-        reactor.stop()
+        if reactor.running:
+            reactor.stop()
 
     def on_command_timeout(self):
         """