mirror of https://github.com/status-im/go-waku.git
fix: prevent panics in peermanager and WakuRelay (#1206)
This commit is contained in:
parent
a4f0cae911
commit
4c3ec60da5
|
@ -125,6 +125,10 @@ func inAndOutRelayPeers(relayPeers int) (int, int) {
|
|||
// checkAndUpdateTopicHealth finds health of specified topic and updates and notifies of the same.
|
||||
// Also returns the healthyPeerCount
|
||||
func (pm *PeerManager) checkAndUpdateTopicHealth(topic *NodeTopicDetails) int {
|
||||
if topic == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
healthyPeerCount := 0
|
||||
|
||||
for _, p := range pm.relay.PubSub().MeshPeers(topic.topic.String()) {
|
||||
|
|
|
@ -493,6 +493,9 @@ func (w *WakuRelay) Unsubscribe(ctx context.Context, contentFilter waku_proto.Co
|
|||
// unsubscribeFromPubsubTopic unsubscribes subscription from underlying pubsub.
|
||||
// Note: caller has to acquire topicsMutex in order to avoid race conditions
|
||||
func (w *WakuRelay) unsubscribeFromPubsubTopic(topicData *pubsubTopicSubscriptionDetails) error {
|
||||
if topicData.subscription == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
pubSubTopic := topicData.subscription.Topic()
|
||||
w.log.Info("unsubscribing from pubsubTopic", zap.String("topic", pubSubTopic))
|
||||
|
|
Loading…
Reference in New Issue