Repository navigation
Commit 555a2ee
committed
iostream: Treat connection resets as a clean close in read_until_close
The change to report errors to a pending read_until_close broke the SSL
variants of test_read_until_close_after_close on windows. There, closing
one side of the connection makes the other side's next read fail with
ECONNRESET instead of returning a clean EOF, so self.error was set and
the pending read failed with StreamClosedError instead of returning the
data that had already been buffered.
IOStream treats a connection reset as a normal close everywhere else
(see _read_to_buffer, which closes the stream and returns instead of
raising), precisely because a clean shutdown by the peer can be reported
this way. Do the same here: resolve a pending read_until_close from the
buffer when the stream is closed cleanly or by a reset, and leave it
pending (to be failed by _signal_closed) only for other errors such as
StreamBufferFullError.
Add a regression test that simulates the windows behavior by turning the
EOF from read_from_fd into an ECONNRESET, so this is covered on all
platforms.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011PBzMWughm8fUFZDTrd8QF1 parent 3ba622f commit 555a2ee
3 files changed
Lines changed: 44 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
592 | 597 | | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
598 | 603 | | |
599 | 604 | | |
600 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
850 | 879 | | |
851 | 880 | | |
852 | 881 | | |
| |||
0 commit comments