Skip to content

Commit

Permalink
disable resource manager
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-tra committed Jan 9, 2025
1 parent 14a2f9f commit d5af513
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ant.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"os"

rcmgr "github.com/libp2p/go-libp2p/p2p/host/resource-manager"

"github.com/caddyserver/certmagic"
ds "github.com/ipfs/go-datastore"
p2pforge "github.com/ipshipyard/p2p-forge/client"
Expand Down Expand Up @@ -99,6 +101,13 @@ func SpawnAnt(ctx context.Context, ps peerstore.Peerstore, ds ds.Batching, cfg *
return nil, fmt.Errorf("new p2pforge cert manager: %w", err)
}

// Configure the resource manager to not limit anything
limiter := rcmgr.NewFixedLimiter(rcmgr.InfiniteLimits)
rcmgr, err := rcmgr.NewResourceManager(limiter)
if err != nil {
return nil, fmt.Errorf("new resource manager: %w", err)
}

listenAddrs := []string{
fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", cfg.Port),
fmt.Sprintf("/ip4/0.0.0.0/udp/%d/quic-v1", cfg.Port),
Expand All @@ -120,6 +129,7 @@ func SpawnAnt(ctx context.Context, ps peerstore.Peerstore, ds ds.Batching, cfg *
libp2p.ListenAddrStrings(listenAddrs...),
libp2p.DisableMetrics(),
libp2p.ShareTCPListener(),
libp2p.ResourceManager(rcmgr),
libp2p.Transport(libp2ptcp.NewTCPTransport),
libp2p.Transport(libp2pquic.NewTransport),
libp2p.Transport(libp2pwebtransport.New),
Expand Down

0 comments on commit d5af513

Please sign in to comment.