Skip to content

Commit 1da7f1e

Browse files
committed
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 <[email protected]>
1 parent cae5c7f commit 1da7f1e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/net/http/server.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,17 @@ func (cr *connReader) setReadLimit(remain int64) { cr.remain = remain }
709709
func (cr *connReader) setInfiniteReadLimit() { cr.remain = maxInt64 }
710710
func (cr *connReader) hitReadLimit() bool { return cr.remain <= 0 }
711711

712-
// may be called from multiple goroutines.
713-
func (cr *connReader) handleReadError(err error) {
712+
// handleReadError is called whenever a Read from the client returns a
713+
// non-nil error.
714+
//
715+
// The provided non-nil err is almost always io.EOF or a "use of
716+
// closed network connection". In any case, the error is not
717+
// particularly interesting, except perhaps for debugging during
718+
// development. Any error means the connection is dead and we should
719+
// down its context.
720+
//
721+
// It may be called from multiple goroutines.
722+
func (cr *connReader) handleReadError(_ error) {
714723
cr.conn.cancelCtx()
715724
cr.closeNotify()
716725
}

0 commit comments

Comments
 (0)