@cryptotaxi247 / kubo / commits / df4b54524

refactor(bootstrap) reduce interface

License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Dec 8, 2014 at 16:11 UTC df4b54524c4c35d12308aa0a7f4cbd365448426f
2 files changed +4 -4
core/bootstrap.go
+3 -3
@@ -20,8 +20,8 @@ const (
20 )
21
22 func superviseConnections(parent context.Context,
23 - n *IpfsNode,
24 - route *dht.IpfsDHT,
23 + n inet.Network,
24 + route *dht.IpfsDHT, // TODO depend on abstract interface for testing purposes
25 store peer.Peerstore,
26 peers []*config.BootstrapPeer) error {
27
@@ -29,7 +29,7 @@ func superviseConnections(parent context.Context,
29 ctx, _ := context.WithTimeout(parent, connectiontimeout)
30 // TODO get config from disk so |peers| always reflects the latest
31 // information
32 - if err := bootstrap(ctx, n.Network, route, store, peers); err != nil {
32 + if err := bootstrap(ctx, n, route, store, peers); err != nil {
33 log.Error(err)
34 }
35 select {
core/core.go
+1 -1
@@ -185,7 +185,7 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
185 // an Exchange, Network, or Routing component and have the constructor
186 // manage the wiring. In that scenario, this dangling function is a bit
187 // awkward.
188 - go superviseConnections(ctx, n, dhtRouting, n.Peerstore, n.Config.Bootstrap)
188 + go superviseConnections(ctx, n.Network, dhtRouting, n.Peerstore, n.Config.Bootstrap)
189 }
190
191 // TODO(brian): when offline instantiate the BlockService with a bitswap