summary refs log tree commit diff
diff options
context:
space:
mode:
-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',