forked from quic-go/quic-go
use a different network timeout before the crypto handshake completes
ref #320
This commit is contained in:
11
session.go
11
session.go
@@ -200,7 +200,7 @@ func (s *Session) run() {
|
||||
if err := s.sendPacket(); err != nil {
|
||||
s.Close(err)
|
||||
}
|
||||
if time.Now().Sub(s.lastNetworkActivityTime) >= s.connectionParametersManager.GetIdleConnectionStateLifetime() {
|
||||
if time.Now().Sub(s.lastNetworkActivityTime) >= s.idleTimeout() {
|
||||
s.Close(qerr.Error(qerr.NetworkIdleTimeout, "No recent network activity."))
|
||||
}
|
||||
if !s.cryptoSetup.HandshakeComplete() && time.Now().Sub(s.sessionCreationTime) >= protocol.MaxTimeForCryptoHandshake {
|
||||
@@ -211,7 +211,7 @@ func (s *Session) run() {
|
||||
}
|
||||
|
||||
func (s *Session) maybeResetTimer() {
|
||||
nextDeadline := s.lastNetworkActivityTime.Add(s.connectionParametersManager.GetIdleConnectionStateLifetime())
|
||||
nextDeadline := s.lastNetworkActivityTime.Add(s.idleTimeout())
|
||||
|
||||
if !s.delayedAckOriginTime.IsZero() {
|
||||
nextDeadline = utils.MinTime(nextDeadline, s.delayedAckOriginTime.Add(protocol.AckSendDelay))
|
||||
@@ -240,6 +240,13 @@ func (s *Session) maybeResetTimer() {
|
||||
s.currentDeadline = nextDeadline
|
||||
}
|
||||
|
||||
func (s *Session) idleTimeout() time.Duration {
|
||||
if s.cryptoSetup.HandshakeComplete() {
|
||||
return s.connectionParametersManager.GetIdleConnectionStateLifetime()
|
||||
}
|
||||
return protocol.InitialIdleTimeout
|
||||
}
|
||||
|
||||
func (s *Session) handlePacketImpl(p *receivedPacket) error {
|
||||
if p.rcvTime.IsZero() {
|
||||
// To simplify testing
|
||||
|
||||
Reference in New Issue
Block a user