Skip to content

Commit

Permalink
config: disallow ThrottlerConfig.MaxRecheckDelay < 1 ms (ava-labs#1435
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gyuho authored May 12, 2023
1 parent 3d2537b commit 9ac856a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ func getNetworkConfig(
return network.Config{}, fmt.Errorf("%q must be >= 0", OutboundConnectionTimeoutKey)
case config.PeerListGossipFreq < 0:
return network.Config{}, fmt.Errorf("%s must be >= 0", NetworkPeerListGossipFreqKey)
case config.ThrottlerConfig.InboundMsgThrottlerConfig.CPUThrottlerConfig.MaxRecheckDelay < constants.MinInboundThrottlerMaxRecheckDelay:
return network.Config{}, fmt.Errorf("%s must be >= %d", InboundThrottlerCPUMaxRecheckDelayKey, constants.MinInboundThrottlerMaxRecheckDelay)
case config.ThrottlerConfig.InboundMsgThrottlerConfig.DiskThrottlerConfig.MaxRecheckDelay < constants.MinInboundThrottlerMaxRecheckDelay:
return network.Config{}, fmt.Errorf("%s must be >= %d", InboundThrottlerDiskMaxRecheckDelayKey, constants.MinInboundThrottlerMaxRecheckDelay)
case config.MaxReconnectDelay < 0:
return network.Config{}, fmt.Errorf("%s must be >= 0", NetworkMaxReconnectDelayKey)
case config.InitialReconnectDelay < 0:
Expand Down
1 change: 1 addition & 0 deletions utils/constants/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const (
DefaultInboundThrottlerBandwidthMaxBurstSize = DefaultMaxMessageSize
DefaultInboundThrottlerCPUMaxRecheckDelay = 5 * time.Second
DefaultInboundThrottlerDiskMaxRecheckDelay = 5 * time.Second
MinInboundThrottlerMaxRecheckDelay = time.Millisecond

// Outbound Throttling
DefaultOutboundThrottlerAtLargeAllocSize = 32 * units.MiB
Expand Down

0 comments on commit 9ac856a

Please sign in to comment.