p2p: put maxMsgPacketPayloadSize, recvRate, sendRate in config

Updates #628
This commit is contained in:
Ethan Buchman
2017-08-31 00:51:43 -04:00
parent f2349b1092
commit daa258ea6d
3 changed files with 58 additions and 29 deletions

View File

@ -90,7 +90,13 @@ func NewSwitch(config *cfg.P2PConfig) *Switch {
dialing: cmn.NewCMap(),
nodeInfo: nil,
}
sw.peerConfig.MConfig.flushThrottle = time.Duration(config.FlushThrottleTimeout) * time.Millisecond // TODO: collapse the peerConfig into the config ?
// TODO: collapse the peerConfig into the config ?
sw.peerConfig.MConfig.flushThrottle = time.Duration(config.FlushThrottleTimeout) * time.Millisecond
sw.peerConfig.MConfig.SendRate = config.SendRate
sw.peerConfig.MConfig.RecvRate = config.RecvRate
sw.peerConfig.MConfig.maxMsgPacketPayloadSize = config.MaxMsgPacketPayloadSize
sw.BaseService = *cmn.NewBaseService(nil, "P2P Switch", sw)
return sw
}
@ -176,7 +182,7 @@ func (sw *Switch) OnStart() error {
return err
}
}
// Start listeners
for _, listener := range sw.listeners {
go sw.listenerRoutine(listener)