Skip to content

Commit

Permalink
79302 Fix panics on sending event related to deleted peer (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemirk committed Jun 8, 2023
1 parent 9ec32dc commit f74d330
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/manager/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ func (s *runtimePeerStatsService) GetRuntimePeerStat(peer *types.PeerInfo) *runt

func (s *runtimePeerStatsService) GetSessions(peer *types.PeerInfo) []Session {
stats := s.GetRuntimePeerStat(peer)
// Stats can gone on peer deletion that's detected on UpdatePeersStats
// In this case we simply return empty sessions list for removed peer
if stats == nil {
return nil
}
return stats.GetSessions()
}

Expand Down

0 comments on commit f74d330

Please sign in to comment.