summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-03-17 10:38:19 -0400
committerKali Kaneko <kali@leap.se>2014-03-17 10:38:19 -0400
commit4d5021c519fd73111f7f88f314491b6a953d9af5 (patch)
tree7ad141766aa4faaf8284337b4c798a049f411943 /src/leap
parent036392269c30ca3468225d8aa4fc1540629071ec (diff)
catch shutdown errors
Diffstat (limited to 'src/leap')
-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