diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-04 10:50:23 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-04 10:50:23 -0300 |
commit | ae9f21073cb166192f4eaa71d02f03da5d9f369d (patch) | |
tree | a3df4a2bd5a7b9ab070734d9639a7819fef84581 | |
parent | 4e1e31fab824c040be243622bcee9f4708f0444c (diff) | |
parent | 740a0a224c058d37ffcbaae64b97714ebde2b313 (diff) |
Merge remote-tracking branch 'chiiph/feature/return_smtp_port' into develop
-rw-r--r-- | changes/return_smtp_port | 2 | ||||
-rw-r--r-- | src/leap/mail/smtp/__init__.py | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/changes/return_smtp_port b/changes/return_smtp_port new file mode 100644 index 0000000..1cf58ef --- /dev/null +++ b/changes/return_smtp_port @@ -0,0 +1,2 @@ + o Return Twisted's smtp Port object to be able to stop listening to + it whenever we want. Related to #3873.
\ No newline at end of file diff --git a/src/leap/mail/smtp/__init__.py b/src/leap/mail/smtp/__init__.py index 2a4abc5..4e5d2a0 100644 --- a/src/leap/mail/smtp/__init__.py +++ b/src/leap/mail/smtp/__init__.py @@ -54,7 +54,7 @@ def setup_smtp_relay(port, keymanager, smtp_host, smtp_port, or not. :type encrypted_only: bool - :returns: SMTPFactory + :returns: tuple of SMTPFactory, twisted.internet.tcp.Port """ # The configuration for the SMTP relay is a dict with the following # format: @@ -77,10 +77,10 @@ def setup_smtp_relay(port, keymanager, smtp_host, smtp_port, # configure the use of this service with twistd factory = SMTPFactory(keymanager, config) try: - reactor.listenTCP(port, factory, - interface="localhost") + tport = reactor.listenTCP(port, factory, + interface="localhost") signal(proto.SMTP_SERVICE_STARTED, str(smtp_port)) - return factory + return factory, tport except CannotListenError: logger.error("STMP Service failed to start: " "cannot listen in port %s" % ( |