From f43954fcd1207b8a6797a1ed2d243b1a448a0708 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Tue, 18 Nov 2014 05:20:04 -0800 Subject: [PATCH] ensure node constructed is online for daemon --- cmd/ipfs2/daemon.go | 7 +++++-- cmd/ipfs2/main.go | 2 +- commands/request.go | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/ipfs2/daemon.go b/cmd/ipfs2/daemon.go index e0e03feea..0194240a3 100644 --- a/cmd/ipfs2/daemon.go +++ b/cmd/ipfs2/daemon.go @@ -46,12 +46,15 @@ the daemon. } func daemonFunc(req cmds.Request) (interface{}, error) { - cfg, err := req.Context().GetConfig() + ctx := req.Context() + cfg, err := ctx.GetConfig() if err != nil { return nil, err } - node, err := core.NewIpfsNode(cfg, true) + // make sure we construct online node. + ctx.Online = true + node, err := ctx.GetNode() if err != nil { return nil, err } diff --git a/cmd/ipfs2/main.go b/cmd/ipfs2/main.go index 497437dc3..66f3b23bc 100644 --- a/cmd/ipfs2/main.go +++ b/cmd/ipfs2/main.go @@ -181,7 +181,7 @@ func (i *cmdInvocation) constructNode() (*core.IpfsNode, error) { // ok everything is good. set it on the invocation (for ownership) // and return it. - i.node, err = core.NewIpfsNode(cfg, false) + i.node, err = core.NewIpfsNode(cfg, ctx.Online) return i.node, err } diff --git a/commands/request.go b/commands/request.go index 0b6f87f95..112e3dde0 100644 --- a/commands/request.go +++ b/commands/request.go @@ -14,6 +14,7 @@ import ( type optMap map[string]interface{} type Context struct { + Online bool ConfigRoot string config *config.Config