summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services/mail
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-09-17 10:44:44 -0400
committerKali Kaneko <kali@leap.se>2015-09-17 16:54:13 -0400
commit26dc74bcc9afbe45d6082e95a3a72cda16d2941b (patch)
tree4b7f67f7f4114b713fa9cff97e5fc51f227b41b3 /src/leap/bitmask/services/mail
parent961d9e6a1c7a5041d5b019581dbf08f16f29ea53 (diff)
[bug] fix assignment of the incoming service
the second callback was actually broken, not being called when it was supposed to be. the reason is that IncomingMail.startService returns a deferred which callback is called with the loopingCall instance only when the loopingCall is stopped.
Diffstat (limited to 'src/leap/bitmask/services/mail')
-rw-r--r--src/leap/bitmask/services/mail/imapcontroller.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/leap/bitmask/services/mail/imapcontroller.py b/src/leap/bitmask/services/mail/imapcontroller.py
index e5313477..5053d897 100644
--- a/src/leap/bitmask/services/mail/imapcontroller.py
+++ b/src/leap/bitmask/services/mail/imapcontroller.py
@@ -27,6 +27,7 @@ class IMAPController(object):
"""
IMAP Controller.
"""
+
def __init__(self, soledad, keymanager):
"""
Initialize IMAP variables.
@@ -63,12 +64,11 @@ class IMAPController(object):
self._soledad,
userid=userid)
- def start_incoming_service(incoming_mail):
- d = incoming_mail.startService()
- d.addCallback(lambda started: incoming_mail)
- return d
-
- def assign_incoming_service(incoming_mail):
+ def start_and_assign_incoming_service(incoming_mail):
+ # this returns a deferred that will be called when the looping call
+ # is stopped, we could add any shutdown/cleanup callback to that
+ # deferred, but unused by the moment.
+ incoming_mail.startService()
self.incoming_mail_service = incoming_mail
return incoming_mail
@@ -78,8 +78,7 @@ class IMAPController(object):
self._soledad,
self.imap_factory,
userid)
- d.addCallback(start_incoming_service)
- d.addCallback(assign_incoming_service)
+ d.addCallback(start_and_assign_incoming_service)
d.addErrback(lambda f: logger.error(f.printTraceback()))
def stop_imap_service(self):