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 committed Dec 22, 2023
1 parent 5067f27 commit 9ac2e2b
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
}

Check warning on line 206 in setup.go

View check run for this annotation

Codecov / codecov/patch

setup.go#L202-L206

Added lines #L202 - L206 were not covered by tests

dhtHost, err = libp2p.New(
libp2p.NoListenAddrs,
libp2p.BandwidthReporter(bwc),
libp2p.DefaultTransports,
libp2p.DefaultMuxers,
libp2p.ResourceManager(dhtMgr),

Check warning on line 213 in setup.go

View check run for this annotation

Codecov / codecov/patch

setup.go#L213

Added line #L213 was not covered by tests
)
if err != nil {
return nil, err
Expand Down

0 comments on commit 9ac2e2b

Please sign in to comment.