summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2015-03-12 15:51:33 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2015-03-12 16:24:51 +0000
commita2cdd11d4a05f76b0be96d7e2de9294a9ff2cd57 (patch)
tree2e0bc0ba3c8741384829ed9db360a93b95c8e776 /synapse/app
parentBuild MetricsResource as a specific HomeServer dependency (diff)
downloadsynapse-a2cdd11d4a05f76b0be96d7e2de9294a9ff2cd57.tar.xz
Fold the slightly-odd bind_port/secure_port/etc.. logic into SynapseHomeServer.start_listening()
Diffstat (limited to '')
-rwxr-xr-xsynapse/app/homeserver.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 3801302c60..2ba701f53f 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -219,17 +219,20 @@ class SynapseHomeServer(HomeServer):
         """
         return "%s-%s" % (resource, path_seg)
 
-    def start_listening(self, secure_port, unsecure_port):
-        if secure_port is not None:
+    def start_listening(self):
+        config = self.get_config()
+
+        if not config.no_tls and config.bind_port is not None:
             reactor.listenSSL(
-                secure_port, Site(self.root_resource), self.tls_context_factory
+                config.bind_port, Site(self.root_resource), self.tls_context_factory
             )
-            logger.info("Synapse now listening on port %d", secure_port)
-        if unsecure_port is not None:
+            logger.info("Synapse now listening on port %d", config.bind_port)
+
+        if config.unsecure_port is not None:
             reactor.listenTCP(
-                unsecure_port, Site(self.root_resource)
+                config.unsecure_port, Site(self.root_resource)
             )
-            logger.info("Synapse now listening on port %d", unsecure_port)
+            logger.info("Synapse now listening on port %d", config.unsecure_port)
 
 
 def get_version_string():
@@ -381,11 +384,7 @@ def setup(config_options):
         f.namespace['hs'] = hs
         reactor.listenTCP(config.manhole, f, interface='127.0.0.1')
 
-    bind_port = config.bind_port
-    if config.no_tls:
-        bind_port = None
-
-    hs.start_listening(bind_port, config.unsecure_port)
+    hs.start_listening()
 
     hs.get_pusherpool().start()
     hs.get_state_handler().start_caching()