Add unsecure listener port to homeserver

This commit is contained in:
Mark Haines 2014-09-01 22:38:52 +01:00
parent 79650f795f
commit 399e004884
2 changed files with 17 additions and 8 deletions

View File

@ -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()

View File

@ -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',