Commit 307c5423 authored by Jeromy Johnson's avatar Jeromy Johnson Committed by GitHub

Merge pull request #3864 from timthelion/refactor/use-ctx-var-consistently

Refactor: use ctx var consistently in daemon.go
parents 1c50ec0c 739a62e3
...@@ -226,7 +226,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { ...@@ -226,7 +226,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
if initialize { if initialize {
cfg := req.InvocContext().ConfigRoot cfg := ctx.ConfigRoot
if !fsrepo.IsInitialized(cfg) { if !fsrepo.IsInitialized(cfg) {
err := initWithDefaults(os.Stdout, cfg) err := initWithDefaults(os.Stdout, cfg)
if err != nil { if err != nil {
...@@ -238,7 +238,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { ...@@ -238,7 +238,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
// acquire the repo lock _before_ constructing a node. we need to make // acquire the repo lock _before_ constructing a node. we need to make
// sure we are permitted to access the resources (datastore, etc.) // sure we are permitted to access the resources (datastore, etc.)
repo, err := fsrepo.Open(req.InvocContext().ConfigRoot) repo, err := fsrepo.Open(ctx.ConfigRoot)
switch err { switch err {
default: default:
res.SetError(err, cmds.ErrNormal) res.SetError(err, cmds.ErrNormal)
...@@ -268,7 +268,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { ...@@ -268,7 +268,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
return return
} }
repo, err = fsrepo.Open(req.InvocContext().ConfigRoot) repo, err = fsrepo.Open(ctx.ConfigRoot)
if err != nil { if err != nil {
res.SetError(err, cmds.ErrNormal) res.SetError(err, cmds.ErrNormal)
return return
...@@ -359,7 +359,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { ...@@ -359,7 +359,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
} }
}() }()
req.InvocContext().ConstructNode = func() (*core.IpfsNode, error) { ctx.ConstructNode = func() (*core.IpfsNode, error) {
return node, nil return node, nil
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment