@@ -124,6 +124,7 @@ type Server struct {
124124 // IdleTimeout specifies how long until idle clients should be
125125 // closed with a GOAWAY frame. PING frames are not considered
126126 // activity for the purposes of IdleTimeout.
127+ // If zero or negative, there is no timeout.
127128 IdleTimeout time.Duration
128129
129130 // MaxUploadBufferPerConnection is the size of the initial flow
@@ -924,7 +925,7 @@ func (sc *serverConn) serve() {
924925 sc .setConnState (http .StateActive )
925926 sc .setConnState (http .StateIdle )
926927
927- if sc .srv .IdleTimeout != 0 {
928+ if sc .srv .IdleTimeout > 0 {
928929 sc .idleTimer = time .AfterFunc (sc .srv .IdleTimeout , sc .onIdleTimer )
929930 defer sc .idleTimer .Stop ()
930931 }
@@ -1637,7 +1638,7 @@ func (sc *serverConn) closeStream(st *stream, err error) {
16371638 delete (sc .streams , st .id )
16381639 if len (sc .streams ) == 0 {
16391640 sc .setConnState (http .StateIdle )
1640- if sc .srv .IdleTimeout != 0 {
1641+ if sc .srv .IdleTimeout > 0 {
16411642 sc .idleTimer .Reset (sc .srv .IdleTimeout )
16421643 }
16431644 if h1ServerKeepAlivesDisabled (sc .hs ) {
0 commit comments