forked from quic-go/quic-go
rename the duration that we keep old connection ID mappings alive
This commit is contained in:
@@ -94,9 +94,9 @@ const DefaultIdleTimeout = 30 * time.Second
|
||||
// DefaultHandshakeTimeout is the default timeout for a connection until the crypto handshake succeeds.
|
||||
const DefaultHandshakeTimeout = 10 * time.Second
|
||||
|
||||
// ClosedSessionDeleteTimeout the server ignores packets arriving on a connection that is already closed
|
||||
// RetiredConnectionIDDeleteTimeout is the time we keep closed sessions around in order to retransmit the CONNECTION_CLOSE.
|
||||
// after this time all information about the old connection will be deleted
|
||||
const ClosedSessionDeleteTimeout = time.Minute
|
||||
const RetiredConnectionIDDeleteTimeout = time.Minute
|
||||
|
||||
// MinStreamFrameSize is the minimum size that has to be left in a packet, so that we add another STREAM frame.
|
||||
// This avoids splitting up STREAM frames into small pieces, which has 2 advantages:
|
||||
|
||||
@@ -26,7 +26,7 @@ type packetHandlerMap struct {
|
||||
server unknownPacketHandler
|
||||
closed bool
|
||||
|
||||
deleteClosedSessionsAfter time.Duration
|
||||
deleteRetiredSessionsAfter time.Duration
|
||||
|
||||
logger utils.Logger
|
||||
}
|
||||
@@ -38,7 +38,7 @@ func newPacketHandlerMap(conn net.PacketConn, connIDLen int, logger utils.Logger
|
||||
conn: conn,
|
||||
connIDLen: connIDLen,
|
||||
handlers: make(map[string]packetHandler),
|
||||
deleteClosedSessionsAfter: protocol.ClosedSessionDeleteTimeout,
|
||||
deleteRetiredSessionsAfter: protocol.RetiredConnectionIDDeleteTimeout,
|
||||
logger: logger,
|
||||
}
|
||||
go m.listen()
|
||||
@@ -56,7 +56,7 @@ func (h *packetHandlerMap) Retire(id protocol.ConnectionID) {
|
||||
}
|
||||
|
||||
func (h *packetHandlerMap) retireByConnectionIDAsString(id string) {
|
||||
time.AfterFunc(h.deleteClosedSessionsAfter, func() {
|
||||
time.AfterFunc(h.deleteRetiredSessionsAfter, func() {
|
||||
h.mutex.Lock()
|
||||
delete(h.handlers, id)
|
||||
h.mutex.Unlock()
|
||||
|
||||
@@ -89,7 +89,7 @@ var _ = Describe("Packet Handler Map", func() {
|
||||
})
|
||||
|
||||
It("deletes closed session entries after a wait time", func() {
|
||||
handler.deleteClosedSessionsAfter = 10 * time.Millisecond
|
||||
handler.deleteRetiredSessionsAfter = 10 * time.Millisecond
|
||||
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}
|
||||
handler.Add(connID, NewMockPacketHandler(mockCtrl))
|
||||
handler.Retire(connID)
|
||||
@@ -98,7 +98,7 @@ var _ = Describe("Packet Handler Map", func() {
|
||||
})
|
||||
|
||||
It("passes packets arriving late for closed sessions to that session", func() {
|
||||
handler.deleteClosedSessionsAfter = time.Hour
|
||||
handler.deleteRetiredSessionsAfter = time.Hour
|
||||
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}
|
||||
packetHandler := NewMockPacketHandler(mockCtrl)
|
||||
packetHandler.EXPECT().GetVersion().Return(protocol.VersionWhatever)
|
||||
|
||||
Reference in New Issue
Block a user