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

@ -224,16 +224,28 @@ type P2PConfig struct {
// Time to wait before flushing messages out on the connection. In ms
FlushThrottleTimeout int `mapstructure:"flush_throttle_timeout"`
// Maximum size of a message packet payload
MaxMsgPacketPayloadSize int `mapstructure:"max_msg_packet_payload_size"`
// Rate at which packets can be sent (in bytes/second)
SendRate int64 `mapstructure:"send_rate"`
// Rate at which packets can be received (in bytes/second)
RecvRate int64 `mapstructure:"recv_rate"`
}
// DefaultP2PConfig returns a default configuration for the peer-to-peer layer
func DefaultP2PConfig() *P2PConfig {
return &P2PConfig{
ListenAddress: "tcp://0.0.0.0:46656",
AddrBook: "addrbook.json",
AddrBookStrict: true,
MaxNumPeers: 50,
FlushThrottleTimeout: 100,
ListenAddress: "tcp://0.0.0.0:46656",
AddrBook: "addrbook.json",
AddrBookStrict: true,
MaxNumPeers: 50,
FlushThrottleTimeout: 100,
MaxMsgPacketPayloadSize: 1024, // 1 kB
SendRate: 512000, // 500 kB/s
RecvRate: 512000, // 500 kB/s
}
}