diff options
author | Matthew Hodgson <matthew@arasphere.net> | 2016-12-19 23:49:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-19 23:49:07 +0000 |
commit | a58e4e0d481e3a868a867cf2f2fb2f728ffbb871 (patch) | |
tree | 22b1543f9a40f26d2bdf00ce2d9513ce9b4de33b /synapse/http/endpoint.py | |
parent | Cache network room list queries. (diff) | |
parent | Bump twisted dependency (diff) | |
download | synapse-a58e4e0d481e3a868a867cf2f2fb2f728ffbb871.tar.xz |
Merge pull request #1696 from kyrias/ipv6
IPv6 support
Diffstat (limited to 'synapse/http/endpoint.py')
-rw-r--r-- | synapse/http/endpoint.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/synapse/http/endpoint.py b/synapse/http/endpoint.py index 442696d393..1c17a28406 100644 --- a/synapse/http/endpoint.py +++ b/synapse/http/endpoint.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from twisted.internet.endpoints import SSL4ClientEndpoint, TCP4ClientEndpoint +from twisted.internet.endpoints import HostnameEndpoint, wrapClientTLS from twisted.internet import defer from twisted.internet.error import ConnectError from twisted.names import client, dns @@ -58,11 +58,13 @@ def matrix_federation_endpoint(reactor, destination, ssl_context_factory=None, endpoint_kw_args.update(timeout=timeout) if ssl_context_factory is None: - transport_endpoint = TCP4ClientEndpoint + transport_endpoint = HostnameEndpoint default_port = 8008 else: - transport_endpoint = SSL4ClientEndpoint - endpoint_kw_args.update(sslContextFactory=ssl_context_factory) + def transport_endpoint(reactor, host, port, timeout): + return wrapClientTLS( + ssl_context_factory, + HostnameEndpoint(reactor, host, port, timeout=timeout)) default_port = 8448 if port is None: @@ -80,7 +82,7 @@ class SpiderEndpoint(object): Implements twisted.internet.interfaces.IStreamClientEndpoint. """ def __init__(self, reactor, host, port, blacklist, whitelist, - endpoint=TCP4ClientEndpoint, endpoint_kw_args={}): + endpoint=HostnameEndpoint, endpoint_kw_args={}): self.reactor = reactor self.host = host self.port = port @@ -118,7 +120,7 @@ class SRVClientEndpoint(object): """ def __init__(self, reactor, service, domain, protocol="tcp", - default_port=None, endpoint=TCP4ClientEndpoint, + default_port=None, endpoint=HostnameEndpoint, endpoint_kw_args={}): self.reactor = reactor self.service_name = "_%s._%s.%s" % (service, protocol, domain) |