[Python-checkins] bpo-43943: ssl tests: Increase server socket timeout, backlog, debugging (GH-25850)

tiran webhook-mailer at python.org
Mon May 3 11:45:10 EDT 2021


https://github.com/python/cpython/commit/c715b524210050bdd2a2e233817246d443bbb236
commit: c715b524210050bdd2a2e233817246d443bbb236
branch: master
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2021-05-03T17:45:02+02:00
summary:

bpo-43943: ssl tests: Increase server socket timeout, backlog, debugging (GH-25850)

Signed-off-by: Christian Heimes <christian at python.org>

files:
M Lib/test/test_ssl.py

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index acb64f15fa0d3..00d5eff81537d 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2587,8 +2587,8 @@ def start(self, flag=None):
         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 @@ def run(self):
                 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 @@ def run(self):
                     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



More information about the Python-checkins mailing list