summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2013-10-30 16:23:31 -0200
committerKali Kaneko <kali@leap.se>2013-10-30 16:23:31 -0200
commitf307305ae941890a228da8edeed7dfac1e2cc65d (patch)
tree08a71e8602c3e52dbb7dd99f31c808ab2ed69cf8
parent755f6d58a1f9434bab8138791cb90fcd72a83fb5 (diff)
parent971058ec42c117d4173f1800ad4457047fc08a4b (diff)
Merge remote-tracking branch 'chiiph/bug/imap_return_factory_and_port' into develop
-rw-r--r--changes/bug_return_factory_and_port_imap2
-rw-r--r--src/leap/mail/imap/service/imap.py10
2 files changed, 8 insertions, 4 deletions
diff --git a/changes/bug_return_factory_and_port_imap b/changes/bug_return_factory_and_port_imap
new file mode 100644
index 0000000..75f96d7
--- /dev/null
+++ b/changes/bug_return_factory_and_port_imap
@@ -0,0 +1,2 @@
+ o Return the necessary references (factory, port) from IMAP4 launch
+ in order to be able to properly stop it. Related to #4199. \ No newline at end of file
diff --git a/src/leap/mail/imap/service/imap.py b/src/leap/mail/imap/service/imap.py
index b840e86..b641d2e 100644
--- a/src/leap/mail/imap/service/imap.py
+++ b/src/leap/mail/imap/service/imap.py
@@ -141,7 +141,9 @@ def run_service(*args, **kwargs):
Main entry point to run the service from the client.
:returns: the LoopingCall instance that will have to be stoppped
- before shutting down the client.
+ before shutting down the client, the port as returned by
+ the reactor when starts listening, and the factory for
+ the protocol.
"""
leap_assert(len(args) == 2)
soledad, keymanager = args
@@ -157,8 +159,8 @@ def run_service(*args, **kwargs):
from twisted.internet import reactor
try:
- reactor.listenTCP(port, factory,
- interface="localhost")
+ tport = reactor.listenTCP(port, factory,
+ interface="localhost")
fetcher = LeapIncomingMail(
keymanager,
soledad,
@@ -174,7 +176,7 @@ def run_service(*args, **kwargs):
fetcher.start_loop()
logger.debug("IMAP4 Server is RUNNING in port %s" % (port,))
leap_events.signal(IMAP_SERVICE_STARTED, str(port))
- return fetcher
+ return fetcher, tport, factory
# not ok, signal error.
leap_events.signal(IMAP_SERVICE_FAILED_TO_START, str(port))