提交 df4b5452 作者: Brian Tiger Chow

refactor(bootstrap) reduce interface

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 7b5eff5c
...@@ -20,8 +20,8 @@ const ( ...@@ -20,8 +20,8 @@ const (
) )
func superviseConnections(parent context.Context, func superviseConnections(parent context.Context,
n *IpfsNode, n inet.Network,
route *dht.IpfsDHT, route *dht.IpfsDHT, // TODO depend on abstract interface for testing purposes
store peer.Peerstore, store peer.Peerstore,
peers []*config.BootstrapPeer) error { peers []*config.BootstrapPeer) error {
...@@ -29,7 +29,7 @@ func superviseConnections(parent context.Context, ...@@ -29,7 +29,7 @@ func superviseConnections(parent context.Context,
ctx, _ := context.WithTimeout(parent, connectiontimeout) ctx, _ := context.WithTimeout(parent, connectiontimeout)
// TODO get config from disk so |peers| always reflects the latest // TODO get config from disk so |peers| always reflects the latest
// information // information
if err := bootstrap(ctx, n.Network, route, store, peers); err != nil { if err := bootstrap(ctx, n, route, store, peers); err != nil {
log.Error(err) log.Error(err)
} }
select { select {
......
...@@ -185,7 +185,7 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) { ...@@ -185,7 +185,7 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
// an Exchange, Network, or Routing component and have the constructor // an Exchange, Network, or Routing component and have the constructor
// manage the wiring. In that scenario, this dangling function is a bit // manage the wiring. In that scenario, this dangling function is a bit
// awkward. // awkward.
go superviseConnections(ctx, n, dhtRouting, n.Peerstore, n.Config.Bootstrap) go superviseConnections(ctx, n.Network, dhtRouting, n.Peerstore, n.Config.Bootstrap)
} }
// TODO(brian): when offline instantiate the BlockService with a bitswap // TODO(brian): when offline instantiate the BlockService with a bitswap
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论