mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Continue reaping bucket after reaping a tuple
Reaping an expired tuple removes it from its bucket so we need to grab the succeeding tuple in the bucket before reaping the expired tuple. Before this change, only the first expired tuple in a bucket was reaped per reaper run on the bucket. This change just allows more connections to be reaped. PiperOrigin-RevId: 404392925
This commit is contained in:
committed by
gVisor bot
parent
80d655d842
commit
64aee33ed0
@@ -562,11 +562,16 @@ func (ct *ConnTrack) reapUnused(start int, prevInterval time.Duration) (int, tim
|
||||
idx = (i + start) % len(ct.buckets)
|
||||
bkt := &ct.buckets[idx]
|
||||
bkt.mu.Lock()
|
||||
for tuple := bkt.tuples.Front(); tuple != nil; tuple = tuple.Next() {
|
||||
for tuple := bkt.tuples.Front(); tuple != nil; {
|
||||
// reapTupleLocked updates tuple's next pointer so we grab it here.
|
||||
nextTuple := tuple.Next()
|
||||
|
||||
checked++
|
||||
if ct.reapTupleLocked(tuple, idx, bkt, now) {
|
||||
expired++
|
||||
}
|
||||
|
||||
tuple = nextTuple
|
||||
}
|
||||
bkt.mu.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user