diff --git a/routingtable/table.go b/routingtable/table.go index 16317e6fc50b7481c8e259be161b8a9bcba644a3..5fcb911c03f9706903c87ad77c80a010931b726b 100644 --- a/routingtable/table.go +++ b/routingtable/table.go @@ -71,13 +71,13 @@ func (rt *RoutingTable) RemovePath(pfx net.Prefix, p *route.Path) { rt.mu.Lock() defer rt.mu.Unlock() - if rt.removePath(pfx, p) { - atomic.AddInt64(&rt.routeCount, -1) - } + rt.removePath(pfx, p) } -func (rt *RoutingTable) removePath(pfx net.Prefix, p *route.Path) bool { - return rt.root.removePath(pfx, p) +func (rt *RoutingTable) removePath(pfx net.Prefix, p *route.Path) { + if rt.root.removePath(pfx, p) { + atomic.AddInt64(&rt.routeCount, -1) + } } func (rt *RoutingTable) removePaths(pfx net.Prefix, paths []*route.Path) {