forked from quic-go/quic-go
reduce memory footprint of the connIDManager
This commit is contained in:
@@ -21,9 +21,9 @@ type connIDManager struct {
|
|||||||
// We change the connection ID after sending on average
|
// We change the connection ID after sending on average
|
||||||
// protocol.PacketsPerConnectionID packets. The actual value is randomized
|
// protocol.PacketsPerConnectionID packets. The actual value is randomized
|
||||||
// hide the packet loss rate from on-path observers.
|
// hide the packet loss rate from on-path observers.
|
||||||
packetsSinceLastChange uint64
|
|
||||||
rand utils.Rand
|
rand utils.Rand
|
||||||
packetsPerConnectionID uint64
|
packetsSinceLastChange uint32
|
||||||
|
packetsPerConnectionID uint32
|
||||||
|
|
||||||
addStatelessResetToken func(protocol.StatelessResetToken)
|
addStatelessResetToken func(protocol.StatelessResetToken)
|
||||||
removeStatelessResetToken func(protocol.StatelessResetToken)
|
removeStatelessResetToken func(protocol.StatelessResetToken)
|
||||||
@@ -148,7 +148,7 @@ func (h *connIDManager) updateConnectionID() {
|
|||||||
h.activeConnectionID = front.ConnectionID
|
h.activeConnectionID = front.ConnectionID
|
||||||
h.activeStatelessResetToken = &front.StatelessResetToken
|
h.activeStatelessResetToken = &front.StatelessResetToken
|
||||||
h.packetsSinceLastChange = 0
|
h.packetsSinceLastChange = 0
|
||||||
h.packetsPerConnectionID = protocol.PacketsPerConnectionID/2 + uint64(h.rand.Int31n(protocol.PacketsPerConnectionID))
|
h.packetsPerConnectionID = protocol.PacketsPerConnectionID/2 + uint32(h.rand.Int31n(protocol.PacketsPerConnectionID))
|
||||||
h.addStatelessResetToken(*h.activeStatelessResetToken)
|
h.addStatelessResetToken(*h.activeStatelessResetToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user