p2p: remove dial sleep and provide disconnect cooldown (backport #8839) (#8876)

* p2p: remove dial sleep and provide disconnect cooldown (#8839)

Alternative proposal for #8826

(cherry picked from commit 52b6dc19ba)

# Conflicts:
#	internal/p2p/router.go

* fix merge

Co-authored-by: Sam Kleinman <garen@tychoish.com>
This commit is contained in:
mergify[bot]
2022-06-24 16:35:27 -04:00
committed by GitHub
co-authored by Sam Kleinman
parent 2fa467fe9b
commit b483058898
5 changed files with 43 additions and 56 deletions
+12 -11
View File
@@ -235,17 +235,18 @@ func createPeerManager(
maxUpgradeConns := uint16(4)
options := p2p.PeerManagerOptions{
SelfAddress: selfAddr,
MaxConnected: maxConns,
MaxOutgoingConnections: maxOutgoingConns,
MaxConnectedUpgrade: maxUpgradeConns,
MaxPeers: maxUpgradeConns + 4*maxConns,
MinRetryTime: 250 * time.Millisecond,
MaxRetryTime: 30 * time.Minute,
MaxRetryTimePersistent: 5 * time.Minute,
RetryTimeJitter: 5 * time.Second,
PrivatePeers: privatePeerIDs,
Metrics: metrics,
SelfAddress: selfAddr,
MaxConnected: maxConns,
MaxOutgoingConnections: maxOutgoingConns,
MaxConnectedUpgrade: maxUpgradeConns,
DisconnectCooldownPeriod: 2 * time.Second,
MaxPeers: maxUpgradeConns + 4*maxConns,
MinRetryTime: 250 * time.Millisecond,
MaxRetryTime: 30 * time.Minute,
MaxRetryTimePersistent: 5 * time.Minute,
RetryTimeJitter: 5 * time.Second,
PrivatePeers: privatePeerIDs,
Metrics: metrics,
}
peers := []p2p.NodeAddress{}