]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: comment handleReadError more, superficially use its argument
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 9 Jul 2018 17:56:56 +0000 (17:56 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 9 Jul 2018 18:37:13 +0000 (18:37 +0000)
Fixes #24201

Change-Id: Ib970c4eeaa90489d014482276a7e5afa94a50741
Reviewed-on: https://go-review.googlesource.com/122675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/server.go

index 9b1095c7030a6e05bf57f3f6613f7af66bc1845b..85aa4935a9ddf1433fc64fc59103bc306909cf22 100644 (file)
@@ -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()
 }