@@ -434,7 +434,7 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
434434 // passes the connection off to us with the deadline already set.
435435 // Write deadlines are set per stream in serverConn.newStream.
436436 // Disarm the net.Conn write deadline here.
437- if sc .hs .WriteTimeout != 0 {
437+ if sc .hs .WriteTimeout > 0 {
438438 sc .conn .SetWriteDeadline (time.Time {})
439439 }
440440
@@ -2017,7 +2017,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
20172017 // similar to how the http1 server works. Here it's
20182018 // technically more like the http1 Server's ReadHeaderTimeout
20192019 // (in Go 1.8), though. That's a more sane option anyway.
2020- if sc .hs .ReadTimeout != 0 {
2020+ if sc .hs .ReadTimeout > 0 {
20212021 sc .conn .SetReadDeadline (time.Time {})
20222022 st .readDeadline = time .AfterFunc (sc .hs .ReadTimeout , st .onReadTimeout )
20232023 }
@@ -2038,7 +2038,7 @@ func (sc *serverConn) upgradeRequest(req *http.Request) {
20382038
20392039 // Disable any read deadline set by the net/http package
20402040 // prior to the upgrade.
2041- if sc .hs .ReadTimeout != 0 {
2041+ if sc .hs .ReadTimeout > 0 {
20422042 sc .conn .SetReadDeadline (time.Time {})
20432043 }
20442044
@@ -2116,7 +2116,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
21162116 st .flow .conn = & sc .flow // link to conn-level counter
21172117 st .flow .add (sc .initialStreamSendWindowSize )
21182118 st .inflow .init (sc .srv .initialStreamRecvWindowSize ())
2119- if sc .hs .WriteTimeout != 0 {
2119+ if sc .hs .WriteTimeout > 0 {
21202120 st .writeDeadline = time .AfterFunc (sc .hs .WriteTimeout , st .onWriteTimeout )
21212121 }
21222122
0 commit comments