mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-07 05:13:23 +00:00
util/lru: update c.head when deleting the most recently used entry
Fixes tailscale/corp#14747 Signed-off-by: David Anderson <danderson@tailscale.com> Co-authored-by: Brad Fitzpatrick <bradfitz@tailscale.com> Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
committed by
Dave Anderson
parent
4232826cce
commit
ed50f360db
@@ -174,6 +174,9 @@ func (c *Cache[K, V]) deleteElement(ent *entry[K, V]) {
|
||||
} else {
|
||||
ent.next.prev = ent.prev
|
||||
ent.prev.next = ent.next
|
||||
if c.head == ent {
|
||||
c.head = ent.next
|
||||
}
|
||||
}
|
||||
delete(c.lookup, ent.key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user