mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
wgengine: use set.HandleSet in another place
I guess we missed this one earlier when we unified the various copies into set.HandleSet. Updates #cleanup Change-Id: I7e6de9ce16e8fc4846abf384dfcc8eaec4d99e60 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
42072683d6
commit
f06e64c562
@ -133,7 +133,7 @@ type userspaceEngine struct {
|
||||
peerSequence []key.NodePublic
|
||||
endpoints []tailcfg.Endpoint
|
||||
pendOpen map[flowtrack.Tuple]*pendingOpenFlow // see pendopen.go
|
||||
networkMapCallbacks map[*someHandle]NetworkMapCallback
|
||||
networkMapCallbacks set.HandleSet[NetworkMapCallback]
|
||||
tsIPByIPPort map[netip.AddrPort]netip.Addr // allows registration of IP:ports as belonging to a certain Tailscale IP for whois lookups
|
||||
|
||||
// pongCallback is the map of response handlers waiting for disco or TSMP
|
||||
@ -1162,10 +1162,9 @@ func (e *userspaceEngine) AddNetworkMapCallback(cb NetworkMapCallback) func() {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
if e.networkMapCallbacks == nil {
|
||||
e.networkMapCallbacks = make(map[*someHandle]NetworkMapCallback)
|
||||
e.networkMapCallbacks = make(set.HandleSet[NetworkMapCallback])
|
||||
}
|
||||
h := new(someHandle)
|
||||
e.networkMapCallbacks[h] = cb
|
||||
h := e.networkMapCallbacks.Add(cb)
|
||||
return func() {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
@ -42,11 +42,6 @@ type Status struct {
|
||||
// into network map updates.
|
||||
type NetworkMapCallback func(*netmap.NetworkMap)
|
||||
|
||||
// someHandle is allocated so its pointer address acts as a unique
|
||||
// map key handle. (It needs to have non-zero size for Go to guarantee
|
||||
// the pointer is unique.)
|
||||
type someHandle struct{ _ byte }
|
||||
|
||||
// ErrNoChanges is returned by Engine.Reconfig if no changes were made.
|
||||
var ErrNoChanges = errors.New("no changes made to Engine config")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user