Skip to content

Commit a09bca2

Browse files
committed
add limit to the number of peers to connect to from px
1 parent dc47d90 commit a09bca2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

gossipsub.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,12 @@ func (gs *GossipSubRouter) addBackoff(p peer.ID, topic string) {
286286
}
287287

288288
func (gs *GossipSubRouter) pxConnect(peers []*pb.PeerInfo) {
289+
if len(peers) > GossipSubPrunePeers {
290+
peers = peers[:GossipSubPrunePeers]
291+
}
292+
289293
toconnect := make([]connectInfo, 0, len(peers))
294+
290295
for _, pi := range peers {
291296
p := peer.ID(pi.PeerID)
292297

0 commit comments

Comments
 (0)