From 318b25373a271c12b3497125db620ab36c0db490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Wed, 30 Oct 2013 15:06:04 -0300 Subject: Properly stop imap at logout --- changes/VERSION_COMPAT | 3 +++ changes/bug_properly_stop_imap | 1 + src/leap/bitmask/services/mail/conductor.py | 23 ++++++++++++----------- 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 changes/bug_properly_stop_imap 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. -- cgit v1.2.3