From a36ccb8525c3285d31fe84b27d2a7419bd7b61b6 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 5 Mar 2020 12:22:33 -0800 Subject: [PATCH] wgengine/magicsock: actually add to the activeDerp map Fixes bug just introduced in 8f9849c140; not tested enough :( --- wgengine/magicsock/magicsock.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index bd5c0ceb7..20fe7073e 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -647,6 +647,7 @@ func (c *Conn) derpWriteChanOfAddr(addr *net.UDPAddr) chan<- derpWriteRequest { ad.c = dc ad.writeCh = ch ad.cancel = cancel + c.activeDerp[addr.Port] = ad go c.runDerpReader(ctx, addr, dc) go c.runDerpWriter(ctx, addr, dc, ch) @@ -700,7 +701,7 @@ func (c *Conn) runDerpReader(ctx context.Context, derpFakeAddr *net.UDPAddr, dc return default: } - log.Printf("derp.Recv: %v", err) + c.logf("derp.Recv(derp%d): %v", derpFakeAddr.Port, err) time.Sleep(250 * time.Millisecond) continue } @@ -916,6 +917,7 @@ func (c *Conn) closeAllDerpLocked() { // c.derpMu must be held. func (c *Conn) closeDerpLocked(node int) { if ad, ok := c.activeDerp[node]; ok { + c.logf("closing connection to derp%v", node) go ad.c.Close() ad.cancel() delete(c.activeDerp, node)