Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support exchange protocols #6171

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/submodule/network/network_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand All @@ -221,6 +223,7 @@ func NewNetworkSubmodule(ctx context.Context,
Bitswap: bswap,
GraphExchange: gsync,
ExchangeClient: exchangeClient,
exchangeServer: exchangeServer,
Network: network,
DataTransfer: dt,
DataTransferHost: dtNet,
Expand All @@ -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
}

Expand Down
Loading