aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/server.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2018-07-09 17:56:56 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2018-07-09 18:37:13 +0000
commit1da7f1e2ee6eea4ee22fc943e2aed41778ea6fbb (patch)
tree8fce17d45ddfd7d2de6be3b541971be6974b1dd9 /src/net/http/server.go
parentcae5c7fe88cfdedb517d853730a99e4e319c219f (diff)
downloadgo-1da7f1e2ee6eea4ee22fc943e2aed41778ea6fbb.tar.xz
net/http: comment handleReadError more, superficially use its argument
Fixes #24201 Change-Id: Ib970c4eeaa90489d014482276a7e5afa94a50741 Reviewed-on: https://go-review.googlesource.com/122675 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/net/http/server.go')
-rw-r--r--src/net/http/server.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/net/http/server.go b/src/net/http/server.go
index 9b1095c703..85aa4935a9 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -709,8 +709,17 @@ func (cr *connReader) setReadLimit(remain int64) { cr.remain = remain }
func (cr *connReader) setInfiniteReadLimit() { cr.remain = maxInt64 }
func (cr *connReader) hitReadLimit() bool { return cr.remain <= 0 }
-// may be called from multiple goroutines.
-func (cr *connReader) handleReadError(err error) {
+// handleReadError is called whenever a Read from the client returns a
+// non-nil error.
+//
+// The provided non-nil err is almost always io.EOF or a "use of
+// closed network connection". In any case, the error is not
+// particularly interesting, except perhaps for debugging during
+// development. Any error means the connection is dead and we should
+// down its context.
+//
+// It may be called from multiple goroutines.
+func (cr *connReader) handleReadError(_ error) {
cr.conn.cancelCtx()
cr.closeNotify()
}