]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler...
authorPetr Viktorin <encukou@gmail.com>
Thu, 7 Nov 2024 10:07:02 +0000 (11:07 +0100)
committerGitHub <noreply@github.com>
Thu, 7 Nov 2024 10:07:02 +0000 (11:07 +0100)
commitc9cda1608edf7664c10f4f467e24591062c2fe62
tree95dade2d76e1f063303a19ac3af9f325ea84d446
parent78ad7e632248dc989378cabeb797b9f3d940d9f2
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)

If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7167285b6544b50865227c584943c9a)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.
Lib/test/test_ssl.py