diff options
author | James McCoy <jamessan@jamessan.com> | 2023-01-09 16:25:59 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-09 16:25:59 +0000 |
commit | 765d82a657c5e42d5d7c88ae410e53f398c34c43 (patch) | |
tree | 32ec90a1ef88bbee28730970da22849974aa0d39 /src/testdir/test_channel_lsp.py | |
parent | 01c5f2addf86b8d8940d71c92f6219f14a6df99e (diff) |
patch 9.0.1165: tests using IPv6 sometimes failv9.0.1165
Problem: Tests using IPv6 sometimes fail.
Solution: Use getaddrinfo() and use try/catch. (James McCoy,
closes #11783)
Diffstat (limited to 'src/testdir/test_channel_lsp.py')
-rw-r--r-- | src/testdir/test_channel_lsp.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/testdir/test_channel_lsp.py b/src/testdir/test_channel_lsp.py index 2357452d7e..10b4fb43f3 100644 --- a/src/testdir/test_channel_lsp.py +++ b/src/testdir/test_channel_lsp.py @@ -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 |