From 2f785216f608ed9dfe6581daa68be518fb6c7ef1 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 2 Jun 2011 11:53:34 -0700 Subject: [PATCH] Show errors when trying failing to properly stop a component --- deluge/component.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deluge/component.py b/deluge/component.py index 4a6f39622..9fa4e3c67 100644 --- a/deluge/component.py +++ b/deluge/component.py @@ -98,6 +98,9 @@ class Component(object): self._component_stopping_deferred = None _ComponentRegistry.register(self) + def __del__(self): + _ComponentRegistry.deregister(self._component_name) + def _component_start_timer(self): if hasattr(self, "update"): self._component_timer = LoopingCall(self.update) @@ -141,11 +144,18 @@ class Component(object): self._component_timer.stop() return True + def on_stop_fail(result): + self._component_state = "Started" + self._component_stopping_deferred = None + log.error(result) + return result + if self._component_state != "Stopped" and self._component_state != "Stopping": if hasattr(self, "stop"): self._component_state = "Stopping" d = maybeDeferred(self.stop) d.addCallback(on_stop) + d.addErrback(on_stop_fail) self._component_stopping_deferred = d else: d = maybeDeferred(on_stop, None)