forked from MirrorHub/synapse
Revert accidental commit of bad file
This commit is contained in:
parent
3553101eb3
commit
c6ea29d916
1 changed files with 24 additions and 37 deletions
|
@ -184,7 +184,15 @@ class SynapseHomeServer(HomeServer):
|
||||||
logger.info("Synapse now listening on port %d", unsecure_port)
|
logger.info("Synapse now listening on port %d", unsecure_port)
|
||||||
|
|
||||||
|
|
||||||
def setup(config, run_http=True):
|
def setup():
|
||||||
|
config = HomeServerConfig.load_config(
|
||||||
|
"Synapse Homeserver",
|
||||||
|
sys.argv[1:],
|
||||||
|
generate_section="Homeserver"
|
||||||
|
)
|
||||||
|
|
||||||
|
config.setup_logging()
|
||||||
|
|
||||||
logger.info("Server hostname: %s", config.server_name)
|
logger.info("Server hostname: %s", config.server_name)
|
||||||
|
|
||||||
if re.search(":[0-9]+$", config.server_name):
|
if re.search(":[0-9]+$", config.server_name):
|
||||||
|
@ -204,13 +212,12 @@ def setup(config, run_http=True):
|
||||||
content_addr=config.content_addr,
|
content_addr=config.content_addr,
|
||||||
)
|
)
|
||||||
|
|
||||||
if run_http:
|
hs.register_servlets()
|
||||||
hs.register_servlets()
|
|
||||||
|
|
||||||
hs.create_resource_tree(
|
hs.create_resource_tree(
|
||||||
web_client=config.webclient,
|
web_client=config.webclient,
|
||||||
redirect_root_to_web_client=True,
|
redirect_root_to_web_client=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
db_name = hs.get_db_name()
|
db_name = hs.get_db_name()
|
||||||
|
|
||||||
|
@ -230,18 +237,11 @@ def setup(config, run_http=True):
|
||||||
f.namespace['hs'] = hs
|
f.namespace['hs'] = hs
|
||||||
reactor.listenTCP(config.manhole, f, interface='127.0.0.1')
|
reactor.listenTCP(config.manhole, f, interface='127.0.0.1')
|
||||||
|
|
||||||
if run_http:
|
bind_port = config.bind_port
|
||||||
bind_port = config.bind_port
|
if config.no_tls:
|
||||||
if config.no_tls:
|
bind_port = None
|
||||||
bind_port = None
|
hs.start_listening(bind_port, config.unsecure_port)
|
||||||
hs.start_listening(bind_port, config.unsecure_port)
|
|
||||||
|
|
||||||
hs.config = config
|
|
||||||
|
|
||||||
return hs
|
|
||||||
|
|
||||||
|
|
||||||
def run(config):
|
|
||||||
if config.daemonize:
|
if config.daemonize:
|
||||||
print config.pid_file
|
print config.pid_file
|
||||||
daemon = Daemonize(
|
daemon = Daemonize(
|
||||||
|
@ -257,26 +257,13 @@ def run(config):
|
||||||
else:
|
else:
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
|
||||||
|
def run():
|
||||||
|
with LoggingContext("run"):
|
||||||
|
reactor.run()
|
||||||
|
|
||||||
def main(args, run_http=True):
|
def main():
|
||||||
with LoggingContext("main"):
|
with LoggingContext("main"):
|
||||||
config = HomeServerConfig.load_config(
|
setup()
|
||||||
"Synapse Homeserver",
|
|
||||||
args,
|
|
||||||
generate_section="Homeserver"
|
|
||||||
)
|
|
||||||
|
|
||||||
config.setup_logging()
|
|
||||||
|
|
||||||
hs = setup(config, run_http=run_http)
|
|
||||||
|
|
||||||
def r():
|
|
||||||
run(config)
|
|
||||||
hs.run = r
|
|
||||||
|
|
||||||
return hs
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
hs = main(sys.argv[1:])
|
main()
|
||||||
hs.run()
|
|
||||||
|
|
Loading…
Reference in a new issue