]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43943: ssl tests: Increase server socket timeout, backlog, debugging (GH-25850)
authorChristian Heimes <christian@python.org>
Mon, 3 May 2021 15:45:02 +0000 (17:45 +0200)
committerGitHub <noreply@github.com>
Mon, 3 May 2021 15:45:02 +0000 (17:45 +0200)
Signed-off-by: Christian Heimes <christian@python.org>
Lib/test/test_ssl.py

index acb64f15fa0d391dd1557efb08da697a88f7c0a3..00d5eff81537d16285708428ff510c35b822ae82 100644 (file)
@@ -2587,8 +2587,8 @@ class ThreadedEchoServer(threading.Thread):
         threading.Thread.start(self)
 
     def run(self):
-        self.sock.settimeout(0.05)
-        self.sock.listen()
+        self.sock.settimeout(1.0)
+        self.sock.listen(5)
         self.active = True
         if self.flag:
             # signal an event
@@ -2602,8 +2602,9 @@ class ThreadedEchoServer(threading.Thread):
                 handler = self.ConnectionHandler(self, newconn, connaddr)
                 handler.start()
                 handler.join()
-            except TimeoutError:
-                pass
+            except TimeoutError as e:
+                if support.verbose:
+                    sys.stdout.write(f' connection timeout {e!r}\n')
             except KeyboardInterrupt:
                 self.stop()
             except BaseException as e:
@@ -2611,7 +2612,12 @@ class ThreadedEchoServer(threading.Thread):
                     sys.stdout.write(
                         ' connection handling failed: ' + repr(e) + '\n')
 
-        self.sock.close()
+        self.close()
+
+    def close(self):
+        if self.sock is not None:
+            self.sock.close()
+            self.sock = None
 
     def stop(self):
         self.active = False