mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
wgengine/magicsock: move trustBestAddrUntil forward on non-disco rx (#10274)
This is gated behind the silent disco control knob, which is still in its infancy. Prior to this change disco pong reception was the only event that could move trustBestAddrUntil forward, so even though we weren't heartbeating, we would kick off discovery pings every trustUDPAddrDuration and mirror to DERP. Updates #540 Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
parent
57129205e6
commit
2ff54f9d12
@ -239,14 +239,22 @@ func (de *endpoint) initFakeUDPAddr() {
|
||||
func (de *endpoint) noteRecvActivity(ipp netip.AddrPort) {
|
||||
now := mono.Now()
|
||||
|
||||
// TODO(raggi): this probably applies relatively equally well to disco
|
||||
// managed endpoints, but that would be a less conservative change.
|
||||
if de.isWireguardOnly {
|
||||
de.mu.Lock()
|
||||
de.bestAddr.AddrPort = ipp
|
||||
de.bestAddrAt = now
|
||||
de.trustBestAddrUntil = now.Add(5 * time.Second)
|
||||
de.mu.Unlock()
|
||||
} else {
|
||||
// TODO(jwhited): subject to change as part of silent disco effort.
|
||||
// Necessary when heartbeat is disabled for the endpoint, otherwise we
|
||||
// kick off discovery disco pings every trustUDPAddrDuration and mirror
|
||||
// to DERP.
|
||||
de.mu.Lock()
|
||||
if de.heartbeatDisabled && de.bestAddr.AddrPort == ipp {
|
||||
de.trustBestAddrUntil = now.Add(trustUDPAddrDuration)
|
||||
}
|
||||
de.mu.Unlock()
|
||||
}
|
||||
|
||||
elapsed := now.Sub(de.lastRecv.LoadAtomic())
|
||||
|
Loading…
Reference in New Issue
Block a user