From e1b71c83acbd722bf13e6eb087270d1655f0eb70 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Sun, 9 Apr 2023 16:48:20 -0700 Subject: [PATCH] wgengine/magicsock: remove unused fields on discoInfo Updates #cleanup Signed-off-by: James Tucker --- wgengine/magicsock/magicsock.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 2be71a038..2168effa1 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -2293,7 +2293,6 @@ func (c *Conn) handleDiscoMessage(msg []byte, src netip.AddrPort, derpNodeSrc ke c.logf("[unexpected] CallMeMaybe from peer via DERP whose netmap discokey != disco source") return } - di.setNodeKey(nodeKey) c.dlogf("[v1] magicsock: disco: %v<-%v (%v, %v) got call-me-maybe, %d endpoints", c.discoShort, epDisco.short, ep.publicKey.ShortString(), derpStr(src.String()), @@ -2357,7 +2356,6 @@ func (c *Conn) handlePingLocked(dm *disco.Ping, src netip.AddrPort, di *discoInf // mapping, and on subsequent disco handlePongLocked to establish // the IP<>disco mapping. if nk, ok := c.unambiguousNodeKeyOfPingLocked(dm, di.discoKey, derpNodeSrc); ok { - di.setNodeKey(nk) if !isDerp { c.peerMap.setNodeKeyForIPPort(src, nk) } @@ -4814,7 +4812,6 @@ func (de *endpoint) handlePongConnLocked(m *disco.Pong, di *discoInfo, src netip } knownTxID = true // for naked returns below de.removeSentPingLocked(m.TxID, sp) - di.setNodeKey(de.publicKey) now := mono.Now() latency := now.Sub(sp.at) @@ -5117,22 +5114,6 @@ type discoInfo struct { // lastPingTime is the last time of a ping for discoKey. lastPingTime time.Time - - // lastNodeKey is the last NodeKey seen using discoKey. - // It's only updated if the NodeKey is unambiguous. - lastNodeKey key.NodePublic - - // lastNodeKeyTime is the time a NodeKey was last seen using - // this discoKey. It's only updated if the NodeKey is - // unambiguous. - lastNodeKeyTime time.Time -} - -// setNodeKey sets the most recent mapping from di.discoKey to the -// NodeKey nk. -func (di *discoInfo) setNodeKey(nk key.NodePublic) { - di.lastNodeKey = nk - di.lastNodeKeyTime = time.Now() } // derpAddrFamSelector is the derphttp.AddressFamilySelector we pass