Mercurial > vim
diff src/testdir/test_channel.py @ 20003:e373843e2980 v8.2.0557
patch 8.2.0557: no IPv6 support for channels
Commit: https://github.com/vim/vim/commit/bfe13ccc58ccb96f243a58309800410db1ccb52c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 12 17:53:12 2020 +0200
patch 8.2.0557: no IPv6 support for channels
Problem: No IPv6 support for channels.
Solution: Add IPv6 support. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/5893)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Apr 2020 18:00:07 +0200 |
parents | 33a2277b8d4d |
children | 235be779549f |
line wrap: on
line diff
--- a/src/testdir/test_channel.py +++ b/src/testdir/test_channel.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Server that will accept connections from a Vim channel. # Used by test_channel.vim. @@ -235,21 +235,19 @@ def writePortInFile(port): f.write("{0}".format(port)) f.close() -if __name__ == "__main__": - HOST, PORT = "localhost", 0 - +def main(host, port, server_class=ThreadedTCPServer): # Wait half a second before opening the port to test waittime in ch_open(). # We do want to get the port number, get that first. We cannot open the # socket, guess a port is free. if len(sys.argv) >= 2 and sys.argv[1] == 'delay': - PORT = 13684 - writePortInFile(PORT) + port = 13684 + writePortInFile(port) print("Wait for it...") time.sleep(0.5) - server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) - ip, port = server.server_address + server = server_class((host, port), ThreadedTCPRequestHandler) + ip, port = server.server_address[0:2] # Start a thread with the server. That thread will then start a new thread # for each connection. @@ -263,7 +261,10 @@ if __name__ == "__main__": # Main thread terminates, but the server continues running # until server.shutdown() is called. try: - while server_thread.isAlive(): + while server_thread.is_alive(): server_thread.join(1) except (KeyboardInterrupt, SystemExit): server.shutdown() + +if __name__ == "__main__": + main("localhost", 0)