cmd/derper: fix embarassing bug introduced in earlier refactor

The remove hook implementation was copy/pasted from the line above and
I didn't change the body, resulting in packet forwarding routes never
being removed.

Fortunately we weren't using this path yet, but it led to stats being
off, and (very) slow memory growth.
reviewable/pr511/r1
Brad Fitzpatrick 4 years ago
parent 36e9cb948f
commit 3553512a71

@ -39,7 +39,7 @@ func startMeshWithHost(s *derp.Server, host string) error {
} }
c.MeshKey = s.MeshKey() c.MeshKey = s.MeshKey()
add := func(k key.Public) { s.AddPacketForwarder(k, c) } add := func(k key.Public) { s.AddPacketForwarder(k, c) }
remove := func(k key.Public) { s.AddPacketForwarder(k, c) } remove := func(k key.Public) { s.RemovePacketForwarder(k, c) }
go c.RunWatchConnectionLoop(s.PublicKey(), add, remove) go c.RunWatchConnectionLoop(s.PublicKey(), add, remove)
return nil return nil
} }

Loading…
Cancel
Save