Commit e0b878a
authored
Rollup merge of #158074 - valentynkt:docs/accept-transient-errors, r=Darksonn
Document transient connection errors from TcpListener::accept
`TcpListener::accept` can return an error that belongs to a single incoming
connection, not to the listener, for example a connection aborted by the peer
before it could be accepted (`ConnectionAborted`). The listener stays usable, so
a server looping over connections usually wants to log the error and keep
accepting rather than treat it as fatal. This was not documented, and the
`incoming` example treated every error as a failed connection.
This implements the libs-team decision in #142557: document these transient
errors instead of changing `accept` to retry them, since retrying would hide
errors that some callers want to observe.
Changes:
- Add an `# Errors` section to `accept` describing this behavior, without
listing specific error codes since some may be more permanent than others.
- Note that `Interrupted` errors are retried internally on Unix.
- Add the same pointer to `incoming` and `into_incoming`, which are `accept`
in a loop.
Addresses #142557.
r? rust-lang/libs1 file changed
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
876 | 876 | | |
877 | 877 | | |
878 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
879 | 902 | | |
880 | 903 | | |
881 | 904 | | |
| |||
902 | 925 | | |
903 | 926 | | |
904 | 927 | | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
905 | 933 | | |
906 | 934 | | |
907 | 935 | | |
| |||
937 | 965 | | |
938 | 966 | | |
939 | 967 | | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
940 | 973 | | |
941 | 974 | | |
942 | 975 | | |
| |||
0 commit comments