comparison src/testdir/test_channel_lsp.py @ 31665:8492bbc9f533 v9.0.1165

patch 9.0.1165: tests using IPv6 sometimes fail Commit: https://github.com/vim/vim/commit/765d82a657c5e42d5d7c88ae410e53f398c34c43 Author: James McCoy <jamessan@jamessan.com> Date: Mon Jan 9 16:25:59 2023 +0000 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 09 Jan 2023 17:30:07 +0100
parents 360f286b5869
children 10a03ae8ba60
comparison
equal deleted inserted replaced
31664:6a7cadad56e7 31665:8492bbc9f533
304 if len(sys.argv) >= 2 and sys.argv[1] == 'delay': 304 if len(sys.argv) >= 2 and sys.argv[1] == 'delay':
305 port = 13684 305 port = 13684
306 writePortInFile(port) 306 writePortInFile(port)
307 time.sleep(0.5) 307 time.sleep(0.5)
308 308
309 server = server_class((host, port), ThreadedTCPRequestHandler) 309 addrs = socket.getaddrinfo(host, port, 0, 0, socket.IPPROTO_TCP)
310 # Each addr is a (family, type, proto, canonname, sockaddr) tuple
311 sockaddr = addrs[0][4]
312 server_class.address_family = addrs[0][0]
313
314 server = server_class(sockaddr[0:2], ThreadedTCPRequestHandler)
310 ip, port = server.server_address[0:2] 315 ip, port = server.server_address[0:2]
311 316
312 # Start a thread with the server. That thread will then start a new thread 317 # Start a thread with the server. That thread will then start a new thread
313 # for each connection. 318 # for each connection.
314 server_thread = threading.Thread(target=server.serve_forever) 319 server_thread = threading.Thread(target=server.serve_forever)