Skip to content

Commit

Permalink
reduce memory footprint of the connIDManager
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Feb 18, 2021
1 parent 115fc28 commit 03fe636
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions conn_id_manager.go
Expand Up @@ -21,9 +21,9 @@ type connIDManager struct {
// We change the connection ID after sending on average
// protocol.PacketsPerConnectionID packets. The actual value is randomized
// hide the packet loss rate from on-path observers.
packetsSinceLastChange uint64
rand utils.Rand
packetsPerConnectionID uint64
packetsSinceLastChange uint32
packetsPerConnectionID uint32

addStatelessResetToken func(protocol.StatelessResetToken)
removeStatelessResetToken func(protocol.StatelessResetToken)
Expand Down Expand Up @@ -148,7 +148,7 @@ func (h *connIDManager) updateConnectionID() {
h.activeConnectionID = front.ConnectionID
h.activeStatelessResetToken = &front.StatelessResetToken
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)
}

Expand Down

0 comments on commit 03fe636

Please sign in to comment.