diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-08-21 15:14:09 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-08-21 15:14:09 -0300 |
commit | 1386a8644b1c215b403bc17745fbac4549a76226 (patch) | |
tree | 15e4270a5e7993157047636c4561f367398b9d9e /src/leap/mail/imap/service | |
parent | 96be9573319456869c76de59b59e309a75fd15a6 (diff) | |
parent | 732923cc59a909b45f5af970702bf299b8d607a5 (diff) |
Merge remote-tracking branch 'kali/feature/add_debug_errors' into develop
Diffstat (limited to 'src/leap/mail/imap/service')
-rw-r--r-- | src/leap/mail/imap/service/imap.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/leap/mail/imap/service/imap.py b/src/leap/mail/imap/service/imap.py index 4dcb49a..b4776f2 100644 --- a/src/leap/mail/imap/service/imap.py +++ b/src/leap/mail/imap/service/imap.py @@ -20,13 +20,14 @@ Imap service initialization from copy import copy import logging -logger = logging.getLogger(__name__) from twisted.internet.protocol import ServerFactory - +from twisted.internet.error import CannotListenError from twisted.mail import imap4 from twisted.python import log +logger = logging.getLogger(__name__) + from leap.common import events as leap_events from leap.common.check import leap_assert, leap_assert_type from leap.keymanager import KeyManager @@ -164,13 +165,17 @@ def run_service(*args, **kwargs): soledad, factory.theAccount, check_period) + except CannotListenError: + logger.error("IMAP Service failed to start: " + "cannot listen in port %s" % (port,)) except Exception as exc: - # XXX cannot listen? logger.error("Error launching IMAP service: %r" % (exc,)) - leap_events.signal(IMAP_SERVICE_FAILED_TO_START, str(port)) - return else: + # all good. fetcher.start_loop() logger.debug("IMAP4 Server is RUNNING in port %s" % (port,)) leap_events.signal(IMAP_SERVICE_STARTED, str(port)) return fetcher + + # not ok, signal error. + leap_events.signal(IMAP_SERVICE_FAILED_TO_START, str(port)) |