0
0
mirror of https://github.com/vim/vim.git synced 2025-10-29 09:37:35 -04:00

patch 9.0.1165: tests using IPv6 sometimes fail

Problem:    Tests using IPv6 sometimes fail.
Solution:   Use getaddrinfo() and use try/catch. (James McCoy,
            closes #11783)
This commit is contained in:
James McCoy
2023-01-09 16:25:59 +00:00
committed by Bram Moolenaar
parent 01c5f2addf
commit 765d82a657
5 changed files with 46 additions and 25 deletions

View File

@@ -306,7 +306,12 @@ def main(host, port, server_class=ThreadedTCPServer):
writePortInFile(port)
time.sleep(0.5)
server = server_class((host, port), ThreadedTCPRequestHandler)
addrs = socket.getaddrinfo(host, port, 0, 0, socket.IPPROTO_TCP)
# Each addr is a (family, type, proto, canonname, sockaddr) tuple
sockaddr = addrs[0][4]
server_class.address_family = addrs[0][0]
server = server_class(sockaddr[0:2], ThreadedTCPRequestHandler)
ip, port = server.server_address[0:2]
# Start a thread with the server. That thread will then start a new thread