Implement listen_tcp method in remaining workers

Signed-off-by: Silke <silke@slxh.eu>
This commit is contained in:
Silke 2017-12-17 14:15:30 +01:00
parent 26cd3f5690
commit df0f602796
10 changed files with 155 additions and 192 deletions

View File

@ -79,16 +79,15 @@ class AppserviceServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse appservice now listening on port %d", port) logger.info("Synapse appservice now listening on port %d", port)
@ -98,17 +97,14 @@ class AppserviceServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -103,16 +103,15 @@ class ClientReaderServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse client reader now listening on port %d", port) logger.info("Synapse client reader now listening on port %d", port)
@ -122,18 +121,16 @@ class ClientReaderServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
),
interface=address
) )
)
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -92,16 +92,15 @@ class FederationReaderServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse federation reader now listening on port %d", port) logger.info("Synapse federation reader now listening on port %d", port)
@ -111,17 +110,14 @@ class FederationReaderServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -106,16 +106,15 @@ class FederationSenderServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse federation_sender now listening on port %d", port) logger.info("Synapse federation_sender now listening on port %d", port)
@ -125,17 +124,14 @@ class FederationSenderServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -157,16 +157,15 @@ class FrontendProxyServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse client reader now listening on port %d", port) logger.info("Synapse client reader now listening on port %d", port)
@ -176,17 +175,14 @@ class FrontendProxyServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -228,10 +228,8 @@ class SynapseHomeServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listener_http(config, listener) self._listener_http(config, listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"]
listen_tcp( listen_tcp(
bind_addresses, listener["bind_addresses"],
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",

View File

@ -99,16 +99,15 @@ class MediaRepositoryServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse media repository now listening on port %d", port) logger.info("Synapse media repository now listening on port %d", port)
@ -118,17 +117,14 @@ class MediaRepositoryServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -114,16 +114,15 @@ class PusherServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse pusher now listening on port %d", port) logger.info("Synapse pusher now listening on port %d", port)
@ -133,17 +132,14 @@ class PusherServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -288,16 +288,15 @@ class SynchrotronServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse synchrotron now listening on port %d", port) logger.info("Synapse synchrotron now listening on port %d", port)
@ -307,17 +306,14 @@ class SynchrotronServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])

View File

@ -131,16 +131,15 @@ class UserDirectoryServer(HomeServer):
root_resource = create_resource_tree(resources, Resource()) root_resource = create_resource_tree(resources, Resource())
for address in bind_addresses: _base.listen_tcp(
reactor.listenTCP( bind_addresses,
port, port,
SynapseSite( SynapseSite(
"synapse.access.http.%s" % (site_tag,), "synapse.access.http.%s" % (site_tag,),
site_tag, site_tag,
listener_config, listener_config,
root_resource, root_resource,
), )
interface=address
) )
logger.info("Synapse user_dir now listening on port %d", port) logger.info("Synapse user_dir now listening on port %d", port)
@ -150,17 +149,14 @@ class UserDirectoryServer(HomeServer):
if listener["type"] == "http": if listener["type"] == "http":
self._listen_http(listener) self._listen_http(listener)
elif listener["type"] == "manhole": elif listener["type"] == "manhole":
bind_addresses = listener["bind_addresses"] _base.listen_tcp(
listener["bind_addresses"],
for address in bind_addresses:
reactor.listenTCP(
listener["port"], listener["port"],
manhole( manhole(
username="matrix", username="matrix",
password="rabbithole", password="rabbithole",
globals={"hs": self}, globals={"hs": self},
), )
interface=address
) )
else: else:
logger.warn("Unrecognized listener type: %s", listener["type"]) logger.warn("Unrecognized listener type: %s", listener["type"])