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.
This commit is contained in:
Brad Fitzpatrick 2020-06-24 19:45:27 -07:00
parent 36e9cb948f
commit 3553512a71

View File

@ -39,7 +39,7 @@ func startMeshWithHost(s *derp.Server, host string) error {
}
c.MeshKey = s.MeshKey()
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)
return nil
}