mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-27 07:38:49 +00:00
wgengine/magicsock: fix BenchmarkReceiveFrom.
Previously, this benchmark relied on behavior of the legacy
receive codepath, which I changed in 22507adf
. With this
change, the benchmark instead relies on the new active discovery
path.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:

committed by
Dave Anderson

parent
2d837f79dc
commit
d456bfdc6d
@@ -681,6 +681,16 @@ func (c *Conn) callNetInfoCallback(ni *tailcfg.NetInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
// addValidDiscoPathForTest makes addr a validated disco address for
|
||||
// discoKey. It's used in tests to enable receiving of packets from
|
||||
// addr without having to spin up the entire active discovery
|
||||
// machinery.
|
||||
func (c *Conn) addValidDiscoPathForTest(discoKey tailcfg.DiscoKey, addr netaddr.IPPort) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.discoOfAddr[addr] = discoKey
|
||||
}
|
||||
|
||||
func (c *Conn) SetNetInfoCallback(fn func(*tailcfg.NetInfo)) {
|
||||
if fn == nil {
|
||||
panic("nil NetInfoCallback")
|
||||
@@ -2147,7 +2157,6 @@ func (c *Conn) SetNetworkMap(nm *controlclient.NetworkMap) {
|
||||
delete(c.sharedDiscoKey, dk)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (c *Conn) wantDerpLocked() bool { return c.derpMap != nil }
|
||||
|
Reference in New Issue
Block a user