Skip to content

Commit

Permalink
Merge pull request #9627 from LexLuthr/fix/idx-provdr-connection
Browse files Browse the repository at this point in the history
fix: index-provider: change connection initiation direction between daemon and market
  • Loading branch information
magik6k authored Nov 23, 2022
2 parents 70dc920 + a425a38 commit 0b85c15
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions markets/idxprov/mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ func (mc Libp2pMeshCreator) Connect(ctx context.Context) error {
return fmt.Errorf("failed to fetch full node listen addrs, err: %w", err)
}

// Connect to the full node, ask it to protect the connection and protect the connection on
// markets end too.
if err := mc.marketsHost.Connect(ctx, faddrs); err != nil {
return fmt.Errorf("failed to connect index provider host with the full node: %w", err)
// Connect from the full node, ask it to protect the connection and protect the connection on
// markets end too. Connection is initiated form full node to avoid the need to expose libp2p port on full node
if err := mc.fullnodeApi.NetConnect(ctx, peer.AddrInfo{
ID: mc.marketsHost.ID(),
Addrs: mc.marketsHost.Addrs(),
}); err != nil {
return fmt.Errorf("failed to connect to index provider host from full node: %w", err)
}
mc.marketsHost.ConnManager().Protect(faddrs.ID, protectTag)

Expand Down

0 comments on commit 0b85c15

Please sign in to comment.