diff options
author | drebs <drebs@riseup.net> | 2016-09-27 20:44:53 -0300 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2016-09-30 13:10:14 -0300 |
commit | 9c4bf6adf42f0f9553ae11f24ffeb6f7cf39f374 (patch) | |
tree | c03b13ae17c0e6267ba8f3ba47c470aed7ad24d4 /src/leap/bitmask/mail/smtp | |
parent | 10f35cacf50148c34b11fba719fc8f734f99def1 (diff) |
[refactor] turn mail services into twisted services
Diffstat (limited to 'src/leap/bitmask/mail/smtp')
-rw-r--r-- | src/leap/bitmask/mail/smtp/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/leap/bitmask/mail/smtp/__init__.py b/src/leap/bitmask/mail/smtp/__init__.py index 4e0ac89..f8b8e65 100644 --- a/src/leap/bitmask/mail/smtp/__init__.py +++ b/src/leap/bitmask/mail/smtp/__init__.py @@ -32,7 +32,7 @@ SMTP_PORT = 2013 def run_service(soledad_sessions, keymanager_sessions, sendmail_opts, - port=SMTP_PORT): + port=SMTP_PORT, factory=None): """ Main entry point to run the service from the client. @@ -46,8 +46,9 @@ def run_service(soledad_sessions, keymanager_sessions, sendmail_opts, the factory for the protocol. :rtype: tuple """ - factory = SMTPFactory(soledad_sessions, keymanager_sessions, - sendmail_opts) + if not factory: + factory = SMTPFactory(soledad_sessions, keymanager_sessions, + sendmail_opts) try: interface = "localhost" @@ -60,7 +61,7 @@ def run_service(soledad_sessions, keymanager_sessions, sendmail_opts, tport = reactor.listenTCP(port, factory, interface=interface) emit_async(catalog.SMTP_SERVICE_STARTED, str(port)) - return factory, tport + return tport, factory except CannotListenError: logger.error("SMTP Service failed to start: " "cannot listen in port %s" % port) |