summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-09-01 22:38:52 +0100
committerMark Haines <mark.haines@matrix.org>2014-09-01 22:38:52 +0100
commit399e0048840ff322091508c02d1877e259973806 (patch)
treeba7fb3f14d98e829586e56bbc133353f016dc883 /synapse
parentenable ECDHE ciphers (diff)
downloadsynapse-399e0048840ff322091508c02d1877e259973806.tar.xz
Add unsecure listener port to homeserver
Diffstat (limited to '')
-rwxr-xr-xsynapse/app/homeserver.py18
-rw-r--r--synapse/config/server.py7
2 files changed, 17 insertions, 8 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index cbbf600f2e..606c9c650d 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -206,11 +206,17 @@ class SynapseHomeServer(HomeServer):
         """
         return "%s-%s" % (resource, path_seg)
 
-    def start_listening(self, port):
-        reactor.listenSSL(
-            port, Site(self.root_resource), self.tls_context_factory
-        )
-        logger.info("Synapse now listening on port %d", port)
+    def start_listening(self, secure_port, unsecure_port):
+        if secure_port is not None:
+            reactor.listenSSL(
+                secure_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:
+            reactor.listenTCP(
+                unsecure_port, Site(self.root_resource)
+            )
+            logger.info("Synapse now listening on port %d", unsecure_port)
 
 
 def run():
@@ -249,7 +255,7 @@ def setup():
         web_client=config.webclient,
         redirect_root_to_web_client=True,
     )
-    hs.start_listening(config.bind_port)
+    hs.start_listening(config.bind_port, config.unsecure_port)
 
     hs.get_db_pool()
 
diff --git a/synapse/config/server.py b/synapse/config/server.py
index 2c80be71b3..1f20d55d8f 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -26,6 +26,7 @@ class ServerConfig(Config):
         self.signing_key = self.read_signing_key(args.signing_key_path)
         self.bind_port = args.bind_port
         self.bind_host = args.bind_host
+        self.unsecure_port = args.unsecure_port
         self.daemonize = args.daemonize
         self.pid_file = self.abspath(args.pid_file)
         self.webclient = args.no_webclient
@@ -39,8 +40,10 @@ class ServerConfig(Config):
                                   help="The name of the server")
         server_group.add_argument("--signing-key-path",
                                   help="The signing key to sign messages with")
-        server_group.add_argument("-p", "--bind-port", metavar="PORT", type=int,
-                                  help="TCP port to listen on")
+        server_group.add_argument("-p", "--bind-port", metavar="PORT",
+                                  type=int, help="https port to listen on")
+        server_group.add_argument("--unsecure-port", metavar="PORT",
+                                  type=int, help="http port to listen on")
         server_group.add_argument("--bind-host", default="",
                                   help="Local interface to listen on")
         server_group.add_argument("-D", "--daemonize", action='store_true',