diff --git a/src/yggdrasil/api.go b/src/yggdrasil/api.go index 13f4cb1..c800cb0 100644 --- a/src/yggdrasil/api.go +++ b/src/yggdrasil/api.go @@ -465,12 +465,14 @@ func (c *Core) RemovePeer(addr string, sintf string) error { } } - ports := c.peers.ports.Load().(map[switchPort]*peer) - for p, peer := range ports { - if addr == peer.intf.name { - c.peers.removePeer(p) + c.peers.Act(nil, func() { + ports := c.peers.ports + for _, peer := range ports { + if addr == peer.intf.name() { + c.peers._removePeer(peer) + } } - } + }) return nil }