mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-27 05:56:07 +00:00
fix: number of connected peers per topic (#948)
This commit is contained in:
parent
6ab2cfb53b
commit
48ab9e6ce7
@ -208,8 +208,16 @@ func (pm *PeerManager) ensureMinRelayConnsPerTopic() {
|
||||
pm.topicMutex.RLock()
|
||||
defer pm.topicMutex.RUnlock()
|
||||
for topicStr, topicInst := range pm.subRelayTopics {
|
||||
curPeers := topicInst.topic.ListPeers()
|
||||
curPeerLen := len(curPeers)
|
||||
|
||||
// @cammellos reported that ListPeers returned an invalid number of
|
||||
// peers. This will ensure that the peers returned by this function
|
||||
// match those peers that are currently connected
|
||||
curPeerLen := 0
|
||||
for _, p := range topicInst.topic.ListPeers() {
|
||||
if pm.host.Network().Connectedness(p) == network.Connected {
|
||||
curPeerLen++
|
||||
}
|
||||
}
|
||||
if curPeerLen < waku_proto.GossipSubOptimalFullMeshSize {
|
||||
pm.logger.Debug("subscribed topic is unhealthy, initiating more connections to maintain health",
|
||||
zap.String("pubSubTopic", topicStr), zap.Int("connectedPeerCount", curPeerLen),
|
||||
|
Loading…
x
Reference in New Issue
Block a user