Skip to content

Commit

Permalink
feat: add resource manager for separate DHT libp2p host
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann authored and hacdias committed Feb 13, 2024
1 parent 0c33656 commit 2fdbd1d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,18 @@ func Setup(ctx context.Context, cfg Config, key crypto.PrivKey, dnsCache *cached
if cfg.DHTSharedHost {
dhtHost = h
} else {
dhtLimiter := rcmgr.NewFixedLimiter(makeResourceManagerConfig(cfg.MaxMemory, cfg.MaxFD, cfg.ConnMgrHi))
dhtMgr, err := rcmgr.NewResourceManager(dhtLimiter)
if err != nil {
return nil, err
}

dhtHost, err = libp2p.New(
libp2p.NoListenAddrs,
libp2p.BandwidthReporter(bwc),
libp2p.DefaultTransports,
libp2p.DefaultMuxers,
libp2p.ResourceManager(dhtMgr),
)
if err != nil {
return nil, err
Expand Down

0 comments on commit 2fdbd1d

Please sign in to comment.