mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-24 18:21:38 +00:00
p2p: NewMultiplexTransport takes an MConnConfig (#2869)
* p2p: NewMultiplexTransport takes an MConnConfig * changelog * move test func to test file
This commit is contained in:
@ -27,6 +27,17 @@ const (
|
||||
reconnectBackOffBaseSeconds = 3
|
||||
)
|
||||
|
||||
// MConnConfig returns an MConnConfig with fields updated
|
||||
// from the P2PConfig.
|
||||
func MConnConfig(cfg *config.P2PConfig) conn.MConnConfig {
|
||||
mConfig := conn.DefaultMConnConfig()
|
||||
mConfig.FlushThrottle = cfg.FlushThrottleTimeout
|
||||
mConfig.SendRate = cfg.SendRate
|
||||
mConfig.RecvRate = cfg.RecvRate
|
||||
mConfig.MaxPacketMsgPayloadSize = cfg.MaxPacketMsgPayloadSize
|
||||
return mConfig
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// An AddrBook represents an address book from the pex package, which is used
|
||||
@ -70,8 +81,6 @@ type Switch struct {
|
||||
filterTimeout time.Duration
|
||||
peerFilters []PeerFilterFunc
|
||||
|
||||
mConfig conn.MConnConfig
|
||||
|
||||
rng *cmn.Rand // seed for randomizing dial times and orders
|
||||
|
||||
metrics *Metrics
|
||||
@ -102,14 +111,6 @@ func NewSwitch(
|
||||
// Ensure we have a completely undeterministic PRNG.
|
||||
sw.rng = cmn.NewRand()
|
||||
|
||||
mConfig := conn.DefaultMConnConfig()
|
||||
mConfig.FlushThrottle = cfg.FlushThrottleTimeout
|
||||
mConfig.SendRate = cfg.SendRate
|
||||
mConfig.RecvRate = cfg.RecvRate
|
||||
mConfig.MaxPacketMsgPayloadSize = cfg.MaxPacketMsgPayloadSize
|
||||
|
||||
sw.mConfig = mConfig
|
||||
|
||||
sw.BaseService = *cmn.NewBaseService(nil, "P2P Switch", sw)
|
||||
|
||||
for _, option := range options {
|
||||
|
Reference in New Issue
Block a user