summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services/mail
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-02-06 15:39:14 -0200
committerdrebs <drebs@leap.se>2014-02-07 16:46:39 -0200
commite4c80d78567d79ff0ad4be8e15629e9ed93259bb (patch)
tree7ebf1eec74e89df9b2c4639c3d21b0c6a7f031d8 /src/leap/bitmask/services/mail
parent0a065eeabf14f794e0aca55c7b16cff816223554 (diff)
Ensure IMAP flushes data to disk before quitting. Closes #5095.
Diffstat (limited to 'src/leap/bitmask/services/mail')
-rw-r--r--src/leap/bitmask/services/mail/conductor.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/leap/bitmask/services/mail/conductor.py b/src/leap/bitmask/services/mail/conductor.py
index fc53923c..f5892468 100644
--- a/src/leap/bitmask/services/mail/conductor.py
+++ b/src/leap/bitmask/services/mail/conductor.py
@@ -95,9 +95,13 @@ class IMAPControl(object):
logger.debug("Starting loop")
self.imap_service.start_loop()
- def stop_imap_service(self):
+ def stop_imap_service(self, cv):
"""
Stops imap service (fetcher, factory and port).
+
+ :param cv: A condition variable to which we can signal when imap
+ indeed stops.
+ :type cv: threading.Condition
"""
self.imap_connection.qtsigs.disconnecting_signal.emit()
# TODO We should homogenize both services.
@@ -110,7 +114,13 @@ class IMAPControl(object):
self.imap_port.stopListening()
# Stop the protocol
self.imap_factory.theAccount.closed = True
- self.imap_factory.doStop()
+ self.imap_factory.doStop(cv)
+ else:
+ # main window does not have to wait because there's no service to
+ # be stopped, so we release the condition variable
+ cv.acquire()
+ cv.notify()
+ cv.release()
def fetch_incoming_mail(self):
"""