提交 bfaffb2d 作者: Łukasz Magiera 提交者: Steven Allen

Fix bootstrap

License: MIT
Signed-off-by: 's avatarŁukasz Magiera <magik6k@gmail.com>
上级 cc2be2e7
......@@ -245,7 +245,7 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
n.IsOnline = cfg.Online
n.app = app
/* n := &IpfsNode{
/* n := &IpfsNode{
IsOnline: cfg.Online,
Repo: cfg.Repo,
ctx: ctx,
......@@ -256,7 +256,7 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
"pk": record.PublicKeyValidator{},
"ipns": ipns.Validator{KeyBook: n.Peerstore},
}
*/
*/
// TODO: port to lifetimes
// n.proc = goprocessctx.WithContextAndTeardown(ctx, n.teardown)
......@@ -268,7 +268,16 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
return nil, app.Err()
}
return n, app.Start(ctx)
if err := app.Start(ctx); err != nil {
return nil, err
}
// TODO: DI-ify bootstrap
if !cfg.Online {
return n, nil
}
return n, n.Bootstrap(DefaultBootstrapConfig)
}
func isTooManyFDError(err error) bool {
......
......@@ -553,7 +553,6 @@ func offlineNamesysCtor(rt routing.IpfsRouting, repo repo.Repo) (namesys.NameSys
return namesys.NewNameSystem(rt, repo.Datastore(), 0), nil
}
////////////
// IPFS services
......@@ -739,11 +738,6 @@ func files(lc fx.Lifecycle, repo repo.Repo, dag format.DAGService) (*mfs.Root, e
return mfs.NewRoot(ctx, dag, nd, pf)
}
// TODO !!!!!!!!
func bootstrap(n IpfsNode) error {
return n.Bootstrap(DefaultBootstrapConfig)
}
////////////
// Hacks
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论