diff options
author | Richard van der Hoff <richard@matrix.org> | 2019-02-13 11:53:43 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2019-02-13 11:58:54 +0000 |
commit | 2a5a15aff8f8d3146df52d5421a6c818637eb629 (patch) | |
tree | 19da096af8da9c7bdfe65dcc08c108380f059e74 /synapse/app/_base.py | |
parent | Special-case the default bind_addresses for metrics listener (diff) | |
download | synapse-2a5a15aff8f8d3146df52d5421a6c818637eb629.tar.xz |
Improve logging around listening services
I wanted to bring listen_tcp into line with listen_ssl in terms of returning a list of ports, and wanted to check that was a safe thing to do - hence the logging in `refresh_certificate`. Also, pull the 'Synapse now listening' message up to homeserver.py, because it was being duplicated everywhere else.
Diffstat (limited to 'synapse/app/_base.py')
-rw-r--r-- | synapse/app/_base.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 1d2c3339ff..c53b644932 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -162,21 +162,23 @@ def listen_tcp(bind_addresses, port, factory, reactor=reactor, backlog=50): Create a TCP socket for a port and several addresses Returns: - list (empty) + list of twisted.internet.tcp.Port listening for TLS connections """ + r = [] for address in bind_addresses: try: - reactor.listenTCP( - port, - factory, - backlog, - address + r.append( + reactor.listenTCP( + port, + factory, + backlog, + address + ) ) except error.CannotListenError as e: check_bind_error(e, address, bind_addresses) - logger.info("Synapse now listening on TCP port %d", port) - return [] + return r def listen_ssl( @@ -203,7 +205,6 @@ def listen_ssl( except error.CannotListenError as e: check_bind_error(e, address, bind_addresses) - logger.info("Synapse now listening on port %d (TLS)", port) return r @@ -229,6 +230,10 @@ def refresh_certificate(hs): # requests. This factory attribute is public but missing from # Twisted's documentation. if isinstance(i.factory, TLSMemoryBIOFactory): + addr = i.getHost() + logger.info( + "Replacing TLS context factory on [%s]:%i", addr.host, addr.port, + ) # We want to replace TLS factories with a new one, with the new # TLS configuration. We do this by reaching in and pulling out # the wrappedFactory, and then re-wrapping it. |