Commit f85e71a
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 (5b95eb9)
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.
(cherry picked from commit c9cda16)
(cherry picked from commit aee80cd)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 6322edd commit f85e71a
1 file changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2488 | 2488 | | |
2489 | 2489 | | |
2490 | 2490 | | |
2491 | | - | |
2492 | 2491 | | |
2493 | 2492 | | |
2494 | 2493 | | |
| |||
2623 | 2622 | | |
2624 | 2623 | | |
2625 | 2624 | | |
2626 | | - | |
2627 | | - | |
2628 | | - | |
2629 | | - | |
2630 | 2625 | | |
2631 | 2626 | | |
2632 | 2627 | | |
| |||
2660 | 2655 | | |
2661 | 2656 | | |
2662 | 2657 | | |
| 2658 | + | |
2663 | 2659 | | |
2664 | 2660 | | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
2665 | 2664 | | |
2666 | 2665 | | |
2667 | 2666 | | |
2668 | 2667 | | |
2669 | 2668 | | |
| 2669 | + | |
| 2670 | + | |
2670 | 2671 | | |
2671 | 2672 | | |
2672 | 2673 | | |
2673 | 2674 | | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
2674 | 2678 | | |
2675 | 2679 | | |
2676 | 2680 | | |
2677 | 2681 | | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
2678 | 2685 | | |
2679 | 2686 | | |
2680 | 2687 | | |
| |||
0 commit comments