wgengine/magicsock: remove unnecessary use of context.

Signed-off-by: David Anderson <danderson@tailscale.com>
reviewable/pr609/r1
David Anderson 4 years ago committed by Dave Anderson
parent b62341d308
commit 9beea8b314

@ -807,16 +807,13 @@ func testActiveDiscovery(t *testing.T, d *devices) {
// from DERP. // from DERP.
mustDirect := func(m1, m2 *magicStack) { mustDirect := func(m1, m2 *magicStack) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) for deadline := time.Now().Add(5 * time.Second); time.Now().Before(deadline); time.Sleep(10 * time.Millisecond) {
defer cancel()
for ctx.Err() == nil {
pst := m1.Status().Peer[m2.Public()] pst := m1.Status().Peer[m2.Public()]
if pst.CurAddr != "" { if pst.CurAddr != "" {
logf("direct link %s->%s found with addr %s", m1, m2, pst.CurAddr) logf("direct link %s->%s found with addr %s", m1, m2, pst.CurAddr)
return return
} }
logf("no direct path %s->%s yet, addrs %v", m1, m2, pst.Addrs) logf("no direct path %s->%s yet, addrs %v", m1, m2, pst.Addrs)
time.Sleep(100 * time.Millisecond)
} }
t.Errorf("magicsock did not find a direct path from %s to %s", m1, m2) t.Errorf("magicsock did not find a direct path from %s to %s", m1, m2)
} }

Loading…
Cancel
Save