ensure node constructed is online for daemon

This commit is contained in:
Juan Batiz-Benet 2014-11-18 05:20:04 -08:00
parent d3c9c5978e
commit f43954fcd1
3 changed files with 7 additions and 3 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -14,6 +14,7 @@ import (
type optMap map[string]interface{}
type Context struct {
Online bool
ConfigRoot string
config *config.Config