Merge pull request #10889 from ipfs/reuse-connevtmanager
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Build / docker-build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run

Bitswap: use a single ConnectEventManager.
This commit is contained in:
Hector Sanjuan 2025-08-06 22:39:25 +02:00 committed by GitHub
commit 58ad11b573
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,9 +88,14 @@ func Bitswap(serverEnabled, libp2pEnabled, httpEnabled bool) interface{} {
var bitswapNetworks, bitswapLibp2p network.BitSwapNetwork
var bitswapBlockstore blockstore.Blockstore = in.Bs
connEvtMgr := network.NewConnectEventManager()
libp2pEnabled := in.Cfg.Bitswap.Libp2pEnabled.WithDefault(config.DefaultBitswapLibp2pEnabled)
if libp2pEnabled {
bitswapLibp2p = bsnet.NewFromIpfsHost(in.Host)
bitswapLibp2p = bsnet.NewFromIpfsHost(
in.Host,
bsnet.WithConnectEventManager(connEvtMgr),
)
}
if httpEnabled {
@ -112,6 +117,7 @@ func Bitswap(serverEnabled, libp2pEnabled, httpEnabled bool) interface{} {
httpnet.WithMaxBlockSize(int64(maxBlockSize)),
httpnet.WithUserAgent(version.GetUserAgentVersion()),
httpnet.WithMetricsLabelsForEndpoints(httpCfg.Allowlist),
httpnet.WithConnectEventManager(connEvtMgr),
)
bitswapNetworks = network.New(in.Host.Peerstore(), bitswapLibp2p, bitswapHTTP)
} else if libp2pEnabled {