summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/backend.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/leap/bitmask/backend.py b/src/leap/bitmask/backend.py
index 34457e34..99e5a04b 100644
--- a/src/leap/bitmask/backend.py
+++ b/src/leap/bitmask/backend.py
@@ -325,7 +325,8 @@ class Backend(object):
Stops the looping call and tries to cancel all the defers.
"""
log.msg("Stopping worker...")
- self._lc.stop()
+ if self._lc.running:
+ self._lc.stop()
while len(self._ongoing_defers) > 0:
d = self._ongoing_defers.pop()
d.cancel()
@@ -392,7 +393,8 @@ class Backend(object):
:param d: defer to remove
:type d: twisted.internet.defer.Deferred
"""
- self._ongoing_defers.remove(d)
+ if d in self._ongoing_defers:
+ self._ongoing_defers.remove(d)
# XXX: Temporal interface until we migrate to zmq
# We simulate the calls to zmq.send_multipart. Once we separate