select good peers for PX, tune the px related limits

This commit is contained in:
vyzo 2020-03-04 14:53:28 +02:00
parent 2ddc4b999f
commit 8fb6924f7c
1 changed files with 4 additions and 4 deletions

View File

@ -42,16 +42,16 @@ var (
GossipSubFanoutTTL = 60 * time.Second GossipSubFanoutTTL = 60 * time.Second
// number of peers to include in prune Peer eXchange // number of peers to include in prune Peer eXchange
GossipSubPrunePeers = 16 GossipSubPrunePeers = 6
// backoff time for pruned peers // backoff time for pruned peers
GossipSubPruneBackoff = time.Minute GossipSubPruneBackoff = time.Minute
// number of active connection attempts for peers obtained through px // number of active connection attempts for peers obtained through px
GossipSubConnectors = 16 GossipSubConnectors = 8
// maximum number of pending connections for peers attempted through px // maximum number of pending connections for peers attempted through px
GossipSubMaxPendingConnections = 1024 GossipSubMaxPendingConnections = 128
// timeout for connection attempts // timeout for connection attempts
GossipSubConnectionTimeout = 30 * time.Second GossipSubConnectionTimeout = 30 * time.Second
@ -1012,7 +1012,7 @@ func (gs *GossipSubRouter) makePrune(p peer.ID, topic string, doPX bool) *pb.Con
if doPX { if doPX {
// select peers for Peer eXchange // select peers for Peer eXchange
peers := gs.getPeers(topic, GossipSubPrunePeers, func(xp peer.ID) bool { peers := gs.getPeers(topic, GossipSubPrunePeers, func(xp peer.ID) bool {
return p != xp return p != xp && gs.score.Score(xp) >= 0
}) })
cab, ok := peerstore.GetCertifiedAddrBook(gs.p.host.Peerstore()) cab, ok := peerstore.GetCertifiedAddrBook(gs.p.host.Peerstore())