Skip to content

Commit

Permalink
support [ipv6] syntax
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@18032 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jan 17, 2018
1 parent d5882ad commit d00fc83
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/xpra/server/socket_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def create_tcp_socket(host, iport):
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockaddr = (host, iport)
else:
if host.startswith("[") and host.endswith("]"):
host = host[1:-1]
assert socket.has_ipv6, "specified an IPv6 address but this is not supported"
res = socket.getaddrinfo(host, iport, socket.AF_INET6, socket.SOCK_STREAM, 0, socket.SOL_TCP)
log = get_network_logger()
Expand All @@ -127,6 +129,7 @@ def create_tcp_socket(host, iport):
sockaddr = res[0][-1]
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, TCP_NODELAY)
log("%s.bind(%s)", listener, sockaddr)
listener.bind(sockaddr)
return listener

Expand Down

0 comments on commit d00fc83

Please sign in to comment.