Skip to content

Commit

Permalink
fix: no limits
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Mar 13, 2023
1 parent 05fb386 commit 5f8e8e6
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions resource.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
package main

import (
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/core/network"
rcmgr "github.com/libp2p/go-libp2p/p2p/host/resource-manager"
)

func NewResourceManager() (network.ResourceManager, error) {
// Copied from:
// https://github.com/libp2p/go-libp2p/blob/98837aad1591a9c5834fb6589318ee443cd12fe3/p2p/host/resource-manager/README.md

scalingLimits := rcmgr.DefaultLimits
libp2p.SetDefaultServiceLimits(&scalingLimits)

scaledDefaultLimits := scalingLimits.AutoScale()

cfg := rcmgr.PartialLimitConfig{
System: rcmgr.ResourceLimits{
ConnsOutbound: rcmgr.Unlimited,
Conns: rcmgr.Unlimited,
ConnsInbound: rcmgr.Unlimited,
},
}

limits := cfg.Build(scaledDefaultLimits)
limiter := rcmgr.NewFixedLimiter(limits)
limiter := rcmgr.NewFixedLimiter(rcmgr.InfiniteLimits)
rm, err := rcmgr.NewResourceManager(limiter)

return rm, err
Expand Down

0 comments on commit 5f8e8e6

Please sign in to comment.