Commit aee80cd
[3.12] pythongh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (pythonGH-126503) (pythonGH-126572)
pythongh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (pythonGH-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)
Co-authored-by: Petr Viktorin <[email protected]>1 parent d62f100 commit aee80cd
1 file changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2300 | 2300 | | |
2301 | 2301 | | |
2302 | 2302 | | |
2303 | | - | |
2304 | 2303 | | |
2305 | 2304 | | |
2306 | 2305 | | |
| |||
2435 | 2434 | | |
2436 | 2435 | | |
2437 | 2436 | | |
2438 | | - | |
2439 | | - | |
2440 | | - | |
2441 | | - | |
2442 | 2437 | | |
2443 | 2438 | | |
2444 | 2439 | | |
| |||
2472 | 2467 | | |
2473 | 2468 | | |
2474 | 2469 | | |
| 2470 | + | |
2475 | 2471 | | |
2476 | 2472 | | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
2477 | 2476 | | |
2478 | 2477 | | |
2479 | 2478 | | |
2480 | 2479 | | |
2481 | 2480 | | |
| 2481 | + | |
| 2482 | + | |
2482 | 2483 | | |
2483 | 2484 | | |
2484 | 2485 | | |
2485 | 2486 | | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
2486 | 2490 | | |
2487 | 2491 | | |
2488 | 2492 | | |
2489 | 2493 | | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
2490 | 2497 | | |
2491 | 2498 | | |
2492 | 2499 | | |
| |||
0 commit comments