diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-12 17:53:12 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-12 17:53:12 +0200 |
commit | bfe13ccc58ccb96f243a58309800410db1ccb52c (patch) | |
tree | 9b11760d9a0a5bfbdfeda140c0f795e80844a556 /src/testdir/test_channel.py | |
parent | c5f1ef53c24cc0c9f7b2131609e916f913634feb (diff) | |
download | vim-git-bfe13ccc58ccb96f243a58309800410db1ccb52c.tar.gz |
patch 8.2.0557: no IPv6 support for channelsv8.2.0557
Problem: No IPv6 support for channels.
Solution: Add IPv6 support. (Ozaki Kiichi, closes #5893)
Diffstat (limited to 'src/testdir/test_channel.py')
-rw-r--r-- | src/testdir/test_channel.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py index bafa9dbf7..6b2947d90 100644 --- 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) |