Skip to content

Commit

Permalink
fix calculation of idle timeout when the peer sets max_idle_timeout t…
Browse files Browse the repository at this point in the history
…o 0 (quic-go#4666)
  • Loading branch information
marten-seemann authored Sep 8, 2024
1 parent 1ad36eb commit 8fc04bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1768,8 +1768,9 @@ func (s *connection) applyTransportParameters() {
params := s.peerParams
// Our local idle timeout will always be > 0.
s.idleTimeout = s.config.MaxIdleTimeout
if s.idleTimeout > 0 && params.MaxIdleTimeout < s.idleTimeout {
s.idleTimeout = params.MaxIdleTimeout
// If the peer advertised an idle timeout, take the minimum of the values.
if params.MaxIdleTimeout > 0 {
s.idleTimeout = min(s.idleTimeout, params.MaxIdleTimeout)
}
s.keepAliveInterval = min(s.config.KeepAlivePeriod, min(s.idleTimeout/2, protocol.MaxKeepAliveInterval))
s.streamsMap.UpdateLimits(params)
Expand Down

0 comments on commit 8fc04bf

Please sign in to comment.