diff --git a/pkg/pan/stats.go b/pkg/pan/stats.go index f4158ff8..e7daf779 100644 --- a/pkg/pan/stats.go +++ b/pkg/pan/stats.go @@ -130,7 +130,7 @@ func (s *pathStatsDB) FirstMoreAlive(p *Path, paths []*Path) int { defer s.mutex.RUnlock() for i, pc := range paths { - if s.IsMoreAlive(pc, p) { + if s.isMoreAliveLocked(pc, p) { return i } } @@ -144,7 +144,10 @@ func (s *pathStatsDB) FirstMoreAlive(p *Path, paths []*Path) int { func (s *pathStatsDB) IsMoreAlive(a, b *Path) bool { s.mutex.RLock() defer s.mutex.RUnlock() + return s.isMoreAliveLocked(a, b) +} +func (s *pathStatsDB) isMoreAliveLocked(a, b *Path) bool { newestA := s.newestDownNotification(a) oldestB := s.oldestDownNotification(b) return newestA.Before(oldestB.Add(-pathDownNotificationTimeout)) // XXX: what is this value, what does it mean?