Skip to content

Commit

Permalink
Merge pull request #6171 from filecoin-project/fix/exchange-protocol
Browse files Browse the repository at this point in the history
fix: support exchange protocols
  • Loading branch information
LinZexiao authored Sep 26, 2023
2 parents 8cca03e + fe9e23d commit 4a7e49c
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 4a7e49c

Please sign in to comment.