Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

IPv6 support for endpoint.py #1690

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions synapse/http/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TCP4ClientEndpoint is used as a default value in in the SpiderEndpoint and SRVClientEndpoint init functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should probably be removed from there; TCP4ClientEndpoint is only interesting as a low-level implementation detail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly pointing it out as another place where it should have been replaced with HostnameEndpoint, but since they're only instantiated in one place, I'm not sure whether it would be simpler to just remove the default value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha; yeah. I'd be inclined to eliminate the default, personally; I find that default args are useful a lot more rarely than they seem like they'd be useful :)

from twisted.internet import defer
from twisted.internet.error import ConnectError
from twisted.names import client, dns
Expand Down Expand Up @@ -58,11 +58,11 @@ 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):
return wrapClientTLS(ssl_context_factory, HostnameEndpoint(reactor, host, port))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wrapper also needs to take a timeout parameter for use in HostnameEndpoint.

default_port = 8448

if port is None:
Expand Down