From fe9e23dae74abb6e86cb151c8c5d98bbbd402bff Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:56:09 +0800 Subject: [PATCH] fix: support exchange protocols --- app/submodule/network/network_submodule.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/submodule/network/network_submodule.go b/app/submodule/network/network_submodule.go index f0e71ccb7d..ebcf7d8b32 100644 --- a/app/submodule/network/network_submodule.go +++ b/app/submodule/network/network_submodule.go @@ -81,6 +81,7 @@ type NetworkSubmodule struct { //nolint PeerMgr peermgr.IPeerMgr ExchangeClient filexchange.Client + exchangeServer filexchange.Server // data transfer DataTransfer datatransfer.Manager DataTransferHost dtnet.DataTransferNetwork @@ -210,6 +211,7 @@ func NewNetworkSubmodule(ctx context.Context, // build network network := net.New(peerHost, rawHost, net.NewRouter(router), bandwidthTracker) exchangeClient := filexchange.NewClient(peerHost, peerMgr) + exchangeServer := filexchange.NewServer(chainStore, messageStore, peerHost) helloHandler := helloprotocol.NewHelloProtocolHandler(peerHost, peerMgr, exchangeClient, chainStore, messageStore, config.GenesisCid(), time.Duration(config.Repo().Config().NetworkParams.BlockDelay)*time.Second) // build the network submdule return &NetworkSubmodule{ @@ -221,6 +223,7 @@ func NewNetworkSubmodule(ctx context.Context, Bitswap: bswap, GraphExchange: gsync, ExchangeClient: exchangeClient, + exchangeServer: exchangeServer, Network: network, DataTransfer: dt, DataTransferHost: dtNet, @@ -236,6 +239,9 @@ func (networkSubmodule *NetworkSubmodule) Start(ctx context.Context) error { if !networkSubmodule.cfg.OfflineMode() { go networkSubmodule.PeerMgr.Run(ctx) } + + networkSubmodule.exchangeServer.Register() + return nil }