@cryptotaxi247 / kubo / commits / f43954fcd

ensure node constructed is online for daemon

Juan Batiz-Benet committed Nov 18, 2014 at 05:20 UTC f43954fcd1207b8a6797a1ed2d243b1a448a0708
3 files changed +7 -3
cmd/ipfs2/daemon.go
+5 -2
@@ -46,12 +46,15 @@ the daemon.
46 }
47
48 func daemonFunc(req cmds.Request) (interface{}, error) {
49 - cfg, err := req.Context().GetConfig()
49 + ctx := req.Context()
50 + cfg, err := ctx.GetConfig()
51 if err != nil {
52 return nil, err
53 }
54
54 - node, err := core.NewIpfsNode(cfg, true)
55 + // make sure we construct online node.
56 + ctx.Online = true
57 + node, err := ctx.GetNode()
58 if err != nil {
59 return nil, err
60 }
cmd/ipfs2/main.go
+1 -1
@@ -181,7 +181,7 @@ func (i *cmdInvocation) constructNode() (*core.IpfsNode, error) {
181
182 // ok everything is good. set it on the invocation (for ownership)
183 // and return it.
184 - i.node, err = core.NewIpfsNode(cfg, false)
184 + i.node, err = core.NewIpfsNode(cfg, ctx.Online)
185 return i.node, err
186 }
187
commands/request.go
+1
@@ -14,6 +14,7 @@ import (
14 type optMap map[string]interface{}
15
16 type Context struct {
17 + Online bool
18 ConfigRoot string
19
20 config *config.Config