Skip to content

Commit

Permalink
Merge pull request #68 from anywherelan/unlimit_resource_manager
Browse files Browse the repository at this point in the history
p2p: use infinite limits for resource manager instead of default
  • Loading branch information
pymq authored Dec 27, 2022
2 parents 0c7ec94 + aa00a18 commit 914884c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions application.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/libp2p/go-libp2p/p2p/host/autorelay"
"github.com/libp2p/go-libp2p/p2p/host/eventbus"
"github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoremem"
rcmgr "github.com/libp2p/go-libp2p/p2p/host/resource-manager"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.zx2c4.com/wireguard/tun"
Expand Down Expand Up @@ -245,6 +246,12 @@ func (a *Application) makeP2pHostConfig() p2p.HostConfig {
panic(err)
}

resourceLimitsConfig := rcmgr.InfiniteLimits
mgr, err := rcmgr.NewResourceManager(rcmgr.NewFixedLimiter(resourceLimitsConfig))
if err != nil {
panic(err)
}

return p2p.HostConfig{
PrivKeyBytes: a.Conf.PrivKey(),
ListenAddrs: a.Conf.GetListenAddresses(),
Expand All @@ -255,10 +262,9 @@ func (a *Application) makeP2pHostConfig() p2p.HostConfig {
libp2p.EnableAutoRelay(
autorelay.WithNumRelays(p2p.DesiredRelays),
autorelay.WithBootDelay(p2p.RelayBootDelay),
// TODO: remove after next minor release
autorelay.WithCircuitV1Support(),
autorelay.WithStaticRelays(a.Conf.GetBootstrapPeers()),
),
libp2p.ResourceManager(mgr),
libp2p.EnableHolePunching(),
libp2p.NATPortMap(),
},
Expand Down

0 comments on commit 914884c

Please sign in to comment.