wgengine/magicsock: log less on no-op disco route switches

Also, renew trustBestAddrUntil even if latency isn't better.
pull/517/head
Brad Fitzpatrick 4 years ago
parent 847b6f039b
commit c52905abaa

@ -2880,11 +2880,15 @@ func (de *discoEndpoint) handlePongConnLocked(m *disco.Pong, src netaddr.IPPort)
// Promote this pong response to our current best address if it's lower latency. // Promote this pong response to our current best address if it's lower latency.
// TODO(bradfitz): decide how latency vs. preference order affects decision // TODO(bradfitz): decide how latency vs. preference order affects decision
if de.bestAddr.IsZero() || delay < de.bestAddrLatency { if de.bestAddr.IsZero() || delay < de.bestAddrLatency {
de.bestAddr = sp.to if de.bestAddr != sp.to {
de.c.logf("magicsock: disco: node %v %v now using %v", de.publicKey.ShortString(), de.discoKey.ShortString(), sp.to)
de.bestAddr = sp.to
}
}
if src == de.bestAddr {
de.bestAddrLatency = delay de.bestAddrLatency = delay
de.bestAddrAt = now de.bestAddrAt = now
de.trustBestAddrUntil = now.Add(5 * time.Second) de.trustBestAddrUntil = now.Add(5 * time.Second)
de.c.logf("magicsock: disco: node %v %v now using %v", de.publicKey.ShortString(), de.discoKey.ShortString(), sp.to)
} }
} }

Loading…
Cancel
Save