Skip to content

Commit

Permalink
Handle network closing in quietReader
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed May 30, 2023
1 parent 6aa5045 commit 439603c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion forwardproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ type quietReader struct {

func (r quietReader) Read(p []byte) (n int, err error) {
n, err = r.reader.Read(p)
if errors.Is(err, syscall.ECONNRESET) {
if err != nil && (errors.Is(err, syscall.ECONNRESET) ||
strings.HasSuffix(err.Error(), "use of closed network connection")) {
err = io.EOF
}
return
Expand Down

0 comments on commit 439603c

Please sign in to comment.