mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +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
|
peerSequence []key.NodePublic
|
||||||
endpoints []tailcfg.Endpoint
|
endpoints []tailcfg.Endpoint
|
||||||
pendOpen map[flowtrack.Tuple]*pendingOpenFlow // see pendopen.go
|
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
|
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
|
// 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()
|
e.mu.Lock()
|
||||||
defer e.mu.Unlock()
|
defer e.mu.Unlock()
|
||||||
if e.networkMapCallbacks == nil {
|
if e.networkMapCallbacks == nil {
|
||||||
e.networkMapCallbacks = make(map[*someHandle]NetworkMapCallback)
|
e.networkMapCallbacks = make(set.HandleSet[NetworkMapCallback])
|
||||||
}
|
}
|
||||||
h := new(someHandle)
|
h := e.networkMapCallbacks.Add(cb)
|
||||||
e.networkMapCallbacks[h] = cb
|
|
||||||
return func() {
|
return func() {
|
||||||
e.mu.Lock()
|
e.mu.Lock()
|
||||||
defer e.mu.Unlock()
|
defer e.mu.Unlock()
|
||||||
|
@ -42,11 +42,6 @@ type NetInfoCallback func(*tailcfg.NetInfo)
|
|||||||
// into network map updates.
|
// into network map updates.
|
||||||
type NetworkMapCallback func(*netmap.NetworkMap)
|
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.
|
// ErrNoChanges is returned by Engine.Reconfig if no changes were made.
|
||||||
var ErrNoChanges = errors.New("no changes made to Engine config")
|
var ErrNoChanges = errors.New("no changes made to Engine config")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user