summaryrefslogtreecommitdiff
path: root/mail/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-21 15:14:09 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-21 15:14:09 -0300
commiteffb83d02d0f5f792dfab10178de72b0e655dd64 (patch)
treea4610e85ad18a49de2d747bdaecf44cd215e1c13 /mail/src
parent8774968f20ff8d6edff5aabf71cf9a08d8566a05 (diff)
parent58ada9baff682dd9e982ae978931a170ac2021b2 (diff)
Merge remote-tracking branch 'kali/feature/add_debug_errors' into develop
Diffstat (limited to 'mail/src')
-rw-r--r--mail/src/leap/mail/imap/service/imap.py15
-rw-r--r--mail/src/leap/mail/smtp/__init__.py5
2 files changed, 15 insertions, 5 deletions
diff --git a/mail/src/leap/mail/imap/service/imap.py b/mail/src/leap/mail/imap/service/imap.py
index 4dcb49a..b4776f2 100644
--- a/mail/src/leap/mail/imap/service/imap.py
+++ b/mail/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))
diff --git a/mail/src/leap/mail/smtp/__init__.py b/mail/src/leap/mail/smtp/__init__.py
index 54f5c81..d5d61bf 100644
--- a/mail/src/leap/mail/smtp/__init__.py
+++ b/mail/src/leap/mail/smtp/__init__.py
@@ -18,10 +18,12 @@
"""
SMTP relay helper function.
"""
+import logging
from twisted.internet import reactor
from twisted.internet.error import CannotListenError
+logger = logging.getLogger(__name__)
from leap.common.events import proto, signal
from leap.mail.smtp.smtprelay import SMTPFactory
@@ -76,4 +78,7 @@ def setup_smtp_relay(port, keymanager, smtp_host, smtp_port,
reactor.listenTCP(port, factory)
signal(proto.SMTP_SERVICE_STARTED, str(smtp_port))
except CannotListenError:
+ logger.error("STMP Service failed to start: "
+ "cannot listen in port %s" % (
+ smtp_port,))
signal(proto.SMTP_SERVICE_FAILED_TO_START, str(smtp_port))