From: Neal Norwitz <nnorwitz@gmail.com>
Date: Tue, 13 Jun 2006 04:08:53 +0000 (+0000)
Subject: Don't fail if another process is listening on our port.
X-Git-Tag: v2.5b1~93
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62bc8aadd4465da30e09c1003cc4bfea014670da;p=python

Don't fail if another process is listening on our port.
---

diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index f93587acbe..9926167967 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -13,7 +13,8 @@ class echo_server(threading.Thread):
     def run(self):
         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-        sock.bind((HOST, PORT))
+        global PORT
+        PORT = test_support.bind_port(sock, HOST, PORT)
         sock.listen(1)
         conn, client = sock.accept()
         buffer = ""