Commit 3597cdd
committed
check for net.ErrClosed instead of "use of closed network connection"
The infamous "use of closed network connection" error was added in
[cl-5649076] as a non-exported error. This made it not possible to
write code to handle it as a sentinel error, other than through string-
matching.
Commit [moby@cc851db] (docker v0.6.4) added a [`IsClosedError`] utility
for this (as [[email protected]] did not yet export this error).
The `IsClosedError` was later moved to the `go-connections` module, but
various other places in our code used similar matching.
There was a feature-request [go-4373] to export it, which
got accepted and implemented in [CL 5649076], so starting with go1.16
we now have [[email protected]], so can remove the string matching.
[CL 5649076]: https://golang.org/cl/5649076
[moby@cc851db]: moby/moby@cc851db
[`IsClosedError`]: https://github.com/moby/moby/blob/cc851dbb3f4725562729f12663e246690a61c620/utils/utils.go#L1032-L1040
[[email protected]]: https://github.com/golang/go/blob/go1.1.2/src/pkg/net/net.go#L341
[go-4373]: golang/go#4373
[[email protected]]: https://github.com/golang/go/blob/go1.16/src/net/net.go#L636-L645
Signed-off-by: Sebastiaan van Stijn <[email protected]>1 parent f145fb3 commit 3597cdd
File tree
3 files changed
+18
-25
lines changed- proxy
- sockets
3 files changed
+18
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
| |||
164 | 163 | | |
165 | 164 | | |
166 | 165 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | | - | |
10 | | - | |
11 | 8 | | |
12 | 9 | | |
13 | 10 | | |
| |||
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
39 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
61 | | - | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
36 | | - | |
37 | | - | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
0 commit comments