clear statistic of former garbage collected routes

This commit is contained in:
lemmi 2021-12-16 09:11:39 +01:00
parent feceec7e53
commit e6f94fc9f1
1 changed files with 8 additions and 2 deletions

10
main.go
View File

@ -143,6 +143,7 @@ func (rs *routeStats) add(prefix netaddr.IPPrefix) {
} else {
delete(rs.gcstats, r.Dst)
r.LastUpdate = time.Time{}
r.UnreachableSince = time.Time{}
}
}
@ -169,8 +170,13 @@ func (rs *routeStats) del(prefix netaddr.IPPrefix) {
rs.Lock()
defer rs.Unlock()
r := rs.stats[prefix]
if r == nil {
var r *route
if r = rs.gcstats[prefix]; r != nil {
delete(rs.gcstats, prefix)
return
}
if r = rs.stats[prefix]; r == nil {
return
}