Skip to content

Commit

Permalink
fix(network): redefine resource limits (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
b00f authored Feb 9, 2024
1 parent 6f02315 commit b744b8e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions network/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ func SubnetsToFilters(subnets []*net.IPNet, action multiaddr.Action) *multiaddr.
func BuildConcreteLimitConfig(maxConns int) lp2prcmgr.ConcreteLimitConfig {
changes := lp2prcmgr.PartialLimitConfig{}

updateResourceLimits := func(limit *lp2prcmgr.ResourceLimits, maxConns, coefficient int) {
maxConnVal := lp2prcmgr.LimitVal(maxConns * coefficient)
updateResourceLimits := func(limit *lp2prcmgr.ResourceLimits, maxConns int, coefficient float32) {
maxConnVal := lp2prcmgr.LimitVal(int(float32(maxConns) * coefficient))

limit.ConnsOutbound = maxConnVal / 2
limit.ConnsInbound = maxConnVal / 2
limit.ConnsOutbound = maxConnVal
limit.Conns = maxConnVal
limit.StreamsOutbound = maxConnVal * 4
limit.StreamsInbound = maxConnVal * 4
limit.StreamsOutbound = maxConnVal * 8
limit.Streams = maxConnVal * 8
}

Expand Down

0 comments on commit b744b8e

Please sign in to comment.