Skip to content

Commit

Permalink
http2: don't log about timeouts reading client preface on new connect…
Browse files Browse the repository at this point in the history
…ions

Updates golang/go#18776

Change-Id: I7568f779e2b86c72c54c8744c08cc02988dde55b
Reviewed-on: https://go-review.googlesource.com/79498
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Tom Bergan <[email protected]>
  • Loading branch information
bradfitz authored and tombergan committed Nov 22, 2017
1 parent 9dfe398 commit fb01801
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions http2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ func (sc *serverConn) condlogf(err error, format string, args ...interface{}) {
if err == nil {
return
}
if err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) {
if err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) || err == errPrefaceTimeout {
// Boring, expected errors.
sc.vlogf(format, args...)
} else {
Expand Down Expand Up @@ -897,8 +897,11 @@ func (sc *serverConn) sendServeMsg(msg interface{}) {
}
}

// readPreface reads the ClientPreface greeting from the peer
// or returns an error on timeout or an invalid greeting.
var errPrefaceTimeout = errors.New("timeout waiting for client preface")

// readPreface reads the ClientPreface greeting from the peer or
// returns errPrefaceTimeout on timeout, or an error if the greeting
// is invalid.
func (sc *serverConn) readPreface() error {
errc := make(chan error, 1)
go func() {
Expand All @@ -916,7 +919,7 @@ func (sc *serverConn) readPreface() error {
defer timer.Stop()
select {
case <-timer.C:
return errors.New("timeout waiting for client preface")
return errPrefaceTimeout
case err := <-errc:
if err == nil {
if VerboseLogs {
Expand Down

0 comments on commit fb01801

Please sign in to comment.