summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/backend/components.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-01-16 20:03:11 -0400
committerKali Kaneko <kali@leap.se>2015-02-11 14:06:44 -0400
commit782fb8d66aabb29d68712e2fc220d967ef8dfcf5 (patch)
tree1bd536cb99e824a288923be90fe7bd7409ea09e7 /src/leap/bitmask/backend/components.py
parent46fabd42ad4cac7ce1b7f1818064f1c2e5c002c1 (diff)
remove use of threading.Condition
we should deal with this with pure deferreds
Diffstat (limited to 'src/leap/bitmask/backend/components.py')
-rw-r--r--src/leap/bitmask/backend/components.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/leap/bitmask/backend/components.py b/src/leap/bitmask/backend/components.py
index 8ed43364..2ae796f6 100644
--- a/src/leap/bitmask/backend/components.py
+++ b/src/leap/bitmask/backend/components.py
@@ -17,13 +17,16 @@
"""
Backend components
"""
+
+# TODO [ ] Get rid of all this deferToThread mess, or at least contain
+# all of it into its own threadpool.
+
import logging
import os
import socket
import time
from functools import partial
-from threading import Condition
from twisted.internet import threads, defer
from twisted.python import log
@@ -1038,12 +1041,10 @@ class Mail(object):
"""
Stop imap and wait until the service is stopped to signal that is done.
"""
- cv = Condition()
- cv.acquire()
- threads.deferToThread(self._imap_controller.stop_imap_service, cv)
+ # FIXME just get a fucking deferred and signal as a callback, with
+ # timeout and cancellability
+ threads.deferToThread(self._imap_controller.stop_imap_service)
logger.debug('Waiting for imap service to stop.')
- cv.wait(self.SERVICE_STOP_TIMEOUT)
- logger.debug('IMAP stopped')
self._signaler.signal(self._signaler.imap_stopped)
def stop_imap_service(self):