add limit to the number of peers to connect to from px

This commit is contained in:
vyzo 2019-12-05 18:53:41 +02:00
parent a4c5325665
commit e4667b6073

View File

@ -288,7 +288,12 @@ func (gs *GossipSubRouter) addBackoff(p peer.ID, topic string) {
}
func (gs *GossipSubRouter) pxConnect(peers []*pb.PeerInfo) {
if len(peers) > GossipSubPrunePeers {
peers = peers[:GossipSubPrunePeers]
}
toconnect := make([]connectInfo, 0, len(peers))
for _, pi := range peers {
p := peer.ID(pi.PeerID)