forked from quic-go/quic-go
set the idle timeout during the handshake to half the handshake timeout
This commit is contained in:
@@ -119,9 +119,6 @@ const CryptoParameterMaxLength = 4000
|
||||
// EphermalKeyLifetime is the lifetime of the ephermal key during the handshake, see handshake.getEphermalKEX.
|
||||
const EphermalKeyLifetime = time.Minute
|
||||
|
||||
// InitialIdleTimeout is the timeout before the handshake succeeds.
|
||||
const InitialIdleTimeout = 5 * time.Second
|
||||
|
||||
// DefaultIdleTimeout is the default idle timeout, for the server
|
||||
const DefaultIdleTimeout = 30 * time.Second
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ func (s *session) idleTimeout() time.Duration {
|
||||
if s.handshakeComplete {
|
||||
return s.connectionParameters.GetIdleConnectionStateLifetime()
|
||||
}
|
||||
return protocol.InitialIdleTimeout
|
||||
return s.config.HandshakeTimeout / 2
|
||||
}
|
||||
|
||||
func (s *session) handlePacketImpl(p *receivedPacket) error {
|
||||
|
||||
@@ -1538,6 +1538,15 @@ var _ = Describe("Session", func() {
|
||||
close(done)
|
||||
})
|
||||
|
||||
It("times out if the idle period is longer than half the handshake timeout", func(done Done) {
|
||||
sess.lastNetworkActivityTime = time.Now().Add(-protocol.DefaultHandshakeTimeout / 2).Add(-time.Millisecond)
|
||||
err := sess.run() // Would normally not return
|
||||
Expect(err.(*qerr.QuicError).ErrorCode).To(Equal(qerr.NetworkIdleTimeout))
|
||||
Expect(mconn.written).To(Receive(ContainSubstring("No recent network activity.")))
|
||||
Expect(sess.Context().Done()).To(BeClosed())
|
||||
close(done)
|
||||
})
|
||||
|
||||
It("uses ICSL after handshake", func(done Done) {
|
||||
close(aeadChanged)
|
||||
mockCpm = mocks.NewMockConnectionParametersManager(mockCtrl)
|
||||
|
||||
Reference in New Issue
Block a user