@@ -124,6 +124,7 @@ type Server struct {
124
124
// IdleTimeout specifies how long until idle clients should be
125
125
// closed with a GOAWAY frame. PING frames are not considered
126
126
// activity for the purposes of IdleTimeout.
127
+ // If zero or negative, there is no timeout.
127
128
IdleTimeout time.Duration
128
129
129
130
// MaxUploadBufferPerConnection is the size of the initial flow
@@ -924,7 +925,7 @@ func (sc *serverConn) serve() {
924
925
sc .setConnState (http .StateActive )
925
926
sc .setConnState (http .StateIdle )
926
927
927
- if sc .srv .IdleTimeout != 0 {
928
+ if sc .srv .IdleTimeout > 0 {
928
929
sc .idleTimer = time .AfterFunc (sc .srv .IdleTimeout , sc .onIdleTimer )
929
930
defer sc .idleTimer .Stop ()
930
931
}
@@ -1637,7 +1638,7 @@ func (sc *serverConn) closeStream(st *stream, err error) {
1637
1638
delete (sc .streams , st .id )
1638
1639
if len (sc .streams ) == 0 {
1639
1640
sc .setConnState (http .StateIdle )
1640
- if sc .srv .IdleTimeout != 0 {
1641
+ if sc .srv .IdleTimeout > 0 {
1641
1642
sc .idleTimer .Reset (sc .srv .IdleTimeout )
1642
1643
}
1643
1644
if h1ServerKeepAlivesDisabled (sc .hs ) {
0 commit comments