diff --git a/core/node/bitswap.go b/core/node/bitswap.go index dc3f7c207..250dc89f6 100644 --- a/core/node/bitswap.go +++ b/core/node/bitswap.go @@ -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 {