mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
util/slicesx: add FirstElementEqual and LastElementEqual
And update a few callers as examples of motivation. (there are a couple others, but these are the ones where it's prettier) Updates #cleanup Change-Id: Ic8c5cb7af0a59c6e790a599136b591ebe16d38eb Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
910462a8e0
commit
cec779e771
@@ -47,6 +47,7 @@ import (
|
||||
"tailscale.com/types/key"
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/set"
|
||||
"tailscale.com/util/slicesx"
|
||||
"tailscale.com/version"
|
||||
)
|
||||
|
||||
@@ -1323,7 +1324,7 @@ func (s *Server) noteClientActivity(c *sclient) {
|
||||
cs.activeClient.Store(c)
|
||||
}
|
||||
|
||||
if sh := dup.sendHistory; len(sh) != 0 && sh[len(sh)-1] == c {
|
||||
if slicesx.LastEqual(dup.sendHistory, c) {
|
||||
// The client c was the last client to make activity
|
||||
// in this set and it was already recorded. Nothing to
|
||||
// do.
|
||||
|
Reference in New Issue
Block a user