summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-10-30 15:06:04 -0300
committerTomás Touceda <chiiph@leap.se>2013-10-30 15:42:37 -0300
commit318b25373a271c12b3497125db620ab36c0db490 (patch)
treed1a664d53405fe28b93b6525f6112f23ac431ece
parent3b9a1aaa1cac94c1e2e0a11d972a61fc1e6655d9 (diff)
Properly stop imap at logout
-rw-r--r--changes/VERSION_COMPAT3
-rw-r--r--changes/bug_properly_stop_imap1
-rw-r--r--src/leap/bitmask/services/mail/conductor.py23
3 files changed, 16 insertions, 11 deletions
diff --git a/changes/VERSION_COMPAT b/changes/VERSION_COMPAT
index cc00ecf7..b5e72ed5 100644
--- a/changes/VERSION_COMPAT
+++ b/changes/VERSION_COMPAT
@@ -8,3 +8,6 @@
#
# BEGIN DEPENDENCY LIST -------------------------
# leap.foo.bar>=x.y.z
+
+leap.mail>=0.3.6
+leap.soledad>=0.4.2 \ No newline at end of file
diff --git a/changes/bug_properly_stop_imap b/changes/bug_properly_stop_imap
new file mode 100644
index 00000000..f2942bad
--- /dev/null
+++ b/changes/bug_properly_stop_imap
@@ -0,0 +1 @@
+- Properly stop the imap daemon at logout. Fixes #4199. \ No newline at end of file
diff --git a/src/leap/bitmask/services/mail/conductor.py b/src/leap/bitmask/services/mail/conductor.py
index 3a3e16a3..c294381b 100644
--- a/src/leap/bitmask/services/mail/conductor.py
+++ b/src/leap/bitmask/services/mail/conductor.py
@@ -48,6 +48,8 @@ class IMAPControl(object):
"""
self.imap_machine = None
self.imap_service = None
+ self.imap_port = None
+ self.imap_factory = None
self.imap_connection = None
leap_register(signal=leap_events.IMAP_SERVICE_STARTED,
@@ -81,7 +83,9 @@ class IMAPControl(object):
if self.imap_service is None:
# first time.
- self.imap_service = imap.start_imap_service(
+ self.imap_service, \
+ self.imap_port, \
+ self.imap_factory = imap.start_imap_service(
self._soledad,
self._keymanager)
else:
@@ -90,17 +94,18 @@ class IMAPControl(object):
def stop_imap_service(self):
"""
- Stops imap service.
-
- There is a subtle difference here:
- we are just stopping the fetcher here,
- but in the smtp case we are stopping the factory.
+ Stops imap service (fetcher, factory and port).
"""
self.imap_connection.qtsigs.disconnecting_signal.emit()
# TODO We should homogenize both services.
if self.imap_service is not None:
logger.debug('Stopping imap service.')
+ # Stop the loop call in the fetcher
self.imap_service.stop()
+ # Stop listening on the IMAP port
+ self.imap_port.stopListening()
+ # Stop the protocol
+ self.imap_factory.doStop()
def fetch_incoming_mail(self):
"""
@@ -208,11 +213,7 @@ class SMTPControl(object):
def stop_smtp_service(self):
"""
- Stops the smtp service.
-
- There is a subtle difference here:
- we are stopping the factory for the smtp service here,
- but in the imap case we are just stopping the fetcher.
+ Stops the smtp service (port and factory).
"""
self.smtp_connection.qtsigs.disconnecting_signal.emit()
# TODO We should homogenize both services.