pass routed host into bitswap construction
Jeromy committed
Feb 16, 2015 at 23:50 UTC
5253b6ab1329fc84101432cd6b8c56085942794d
1 file changed
+4
-4
core/core.go
+4
-4
@@ -235,9 +235,6 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
235
return err
236
}
237
238
- // Wrap standard peer host with routing system to allow unknown peer lookups
239
- n.PeerHost = rhost.Wrap(peerhost, n.Routing)
240
-
238
// Ok, now we're ready to listen.
239
if err := startListening(ctx, n.PeerHost, n.Repo.Config()); err != nil {
240
return debugerror.Wrap(err)
@@ -252,6 +249,9 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
249
// startOnlineServicesWithHost is the set of services which need to be
250
// initialized with the host and _before_ we start listening.
251
func (n *IpfsNode) startOnlineServicesWithHost(ctx context.Context, host p2phost.Host, routingOption RoutingOption) error {
252
+ // Wrap standard peer host with routing system to allow unknown peer lookups
253
+ n.PeerHost = rhost.Wrap(host, n.Routing)
254
+
255
// setup diagnostics service
256
n.Diagnostics = diag.NewDiagnostics(n.Identity, host)
257
@@ -264,7 +264,7 @@ func (n *IpfsNode) startOnlineServicesWithHost(ctx context.Context, host p2phost
264
265
// setup exchange service
266
const alwaysSendToPeer = true // use YesManStrategy
267
- bitswapNetwork := bsnet.NewFromIpfsHost(host, n.Routing)
267
+ bitswapNetwork := bsnet.NewFromIpfsHost(n.PeerHost, n.Routing)
268
n.Exchange = bitswap.New(ctx, n.Identity, bitswapNetwork, n.Blockstore, alwaysSendToPeer)
269
270
// setup name system