Commit 461ca2c
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 <[email protected]>
1 parent ab47462 commit 461ca2c
1 file changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2516 | 2516 | | |
2517 | 2517 | | |
2518 | 2518 | | |
2519 | | - | |
2520 | 2519 | | |
2521 | 2520 | | |
2522 | 2521 | | |
| |||
2651 | 2650 | | |
2652 | 2651 | | |
2653 | 2652 | | |
2654 | | - | |
2655 | | - | |
2656 | | - | |
2657 | | - | |
2658 | 2653 | | |
2659 | 2654 | | |
2660 | 2655 | | |
| |||
2688 | 2683 | | |
2689 | 2684 | | |
2690 | 2685 | | |
| 2686 | + | |
2691 | 2687 | | |
2692 | 2688 | | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
2693 | 2692 | | |
2694 | 2693 | | |
2695 | 2694 | | |
2696 | 2695 | | |
2697 | 2696 | | |
| 2697 | + | |
| 2698 | + | |
2698 | 2699 | | |
2699 | 2700 | | |
2700 | 2701 | | |
2701 | 2702 | | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
2702 | 2706 | | |
2703 | 2707 | | |
2704 | 2708 | | |
2705 | 2709 | | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
2706 | 2713 | | |
2707 | 2714 | | |
2708 | 2715 | | |
| |||
0 commit comments