mirror of https://github.com/poanetwork/gecko.git
Merge pull request #9 from StephenButtolph/msg-size
properly set the max message size with salticidae
This commit is contained in:
commit
7404200a0b
|
@ -45,6 +45,10 @@ import (
|
|||
"github.com/ava-labs/gecko/vms/timestampvm"
|
||||
)
|
||||
|
||||
const (
|
||||
maxMessageSize = 1 << 25 // maximum size of a message sent with salticidae
|
||||
)
|
||||
|
||||
// MainNode is the reference for node callbacks
|
||||
var MainNode = Node{}
|
||||
|
||||
|
@ -54,7 +58,7 @@ type Node struct {
|
|||
LogFactory logging.Factory
|
||||
HTTPLog logging.Logger
|
||||
|
||||
// This node's unique ID used when communicationg with other nodes
|
||||
// This node's unique ID used when communicating with other nodes
|
||||
// (in consensus, for example)
|
||||
ID ids.ShortID
|
||||
|
||||
|
@ -138,6 +142,7 @@ func (n *Node) initNetlib() error {
|
|||
peerConfig := salticidae.NewPeerNetworkConfig()
|
||||
if n.Config.EnableStaking {
|
||||
msgConfig := peerConfig.AsMsgNetworkConfig()
|
||||
msgConfig.MaxMsgSize(maxMessageSize)
|
||||
msgConfig.EnableTLS(true)
|
||||
msgConfig.TLSKeyFile(n.Config.StakingKeyFile)
|
||||
msgConfig.TLSCertFile(n.Config.StakingCertFile)
|
||||
|
@ -156,6 +161,7 @@ func (n *Node) initNetlib() error {
|
|||
if n.Config.ThroughputServerEnabled {
|
||||
// Create the client network
|
||||
msgConfig := salticidae.NewMsgNetworkConfig()
|
||||
msgConfig.MaxMsgSize(maxMessageSize)
|
||||
n.ClientNet = salticidae.NewMsgNetwork(n.EC, msgConfig, &err)
|
||||
if code := err.GetCode(); code != 0 {
|
||||
return errors.New(salticidae.StrError(code))
|
||||
|
|
|
@ -25,8 +25,8 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
defaultMaxSize = 1 << 19 // default max size, in bytes, of something being marshalled by Marshal()
|
||||
defaultMaxSliceLength = 1 << 19 // default max length of a slice being marshalled by Marshal()
|
||||
defaultMaxSize = 1 << 18 // default max size, in bytes, of something being marshalled by Marshal()
|
||||
defaultMaxSliceLength = 1 << 18 // default max length of a slice being marshalled by Marshal()
|
||||
)
|
||||
|
||||
// ErrBadCodec is returned when one tries to perform an operation
|
||||
|
|
Loading…
Reference in New Issue