Skip to content

Commit

Permalink
simpler re-allocation for closed connections
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux committed Oct 19, 2024
1 parent 85bd902 commit 078834f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/network/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,7 @@ type client struct {
}

func (c *client) Reset() {
half := cap(c.closed.conns) / 2
if closedLen := len(c.closed.conns); closedLen > minClosedCapacity && closedLen < half {
c.closed.conns = make([]ConnectionStats, half)
}

c.closed.conns = c.closed.conns[:0]
c.closed.conns = make([]ConnectionStats, 0, minClosedCapacity)
c.closed.byCookie = make(map[StatCookie]int)
c.dnsStats = make(dns.StatsByKeyByNameByType)
c.httpStatsDelta = make(map[http.Key]*http.RequestStats)
Expand Down

0 comments on commit 078834f

Please sign in to comment.