server: Cap max outbound in connmgr cfg at max peers
This commit is contained in:
parent
6951d8e235
commit
d1c39edee8
1 changed files with 5 additions and 1 deletions
|
@ -2440,9 +2440,13 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a connection manager.
|
// Create a connection manager.
|
||||||
|
maxOutbound := defaultMaxOutbound
|
||||||
|
if cfg.MaxPeers < maxOutbound {
|
||||||
|
maxOutbound = cfg.MaxPeers
|
||||||
|
}
|
||||||
cmgr, err := connmgr.New(&connmgr.Config{
|
cmgr, err := connmgr.New(&connmgr.Config{
|
||||||
RetryDuration: connectionRetryInterval,
|
RetryDuration: connectionRetryInterval,
|
||||||
MaxOutbound: defaultMaxOutbound,
|
MaxOutbound: uint32(maxOutbound),
|
||||||
Dial: btcdDial,
|
Dial: btcdDial,
|
||||||
OnConnection: s.outboundPeerConnected,
|
OnConnection: s.outboundPeerConnected,
|
||||||
GetNewAddress: newAddressFunc,
|
GetNewAddress: newAddressFunc,
|
||||||
|
|
Loading…
Add table
Reference in a new issue