1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 17:22:21 +08:00

make ipfs understand the new migration

This commit is contained in:
Jeromy
2015-04-09 17:13:04 -07:00
committed by Juan Batiz-Benet
parent 96a22c5bb1
commit c419a489e1
3 changed files with 41 additions and 30 deletions

View File

@ -103,21 +103,16 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
}
}
// To ensure that IPFS has been initialized, fetch the config. Do this
// _before_ acquiring the daemon lock so the user gets an appropriate error
// message.
// NB: It's safe to read the config without the daemon lock, but not safe
// to write.
ctx := req.Context()
cfg, err := ctx.GetConfig()
// acquire the repo lock _before_ constructing a node. we need to make
// sure we are permitted to access the resources (datastore, etc.)
repo, err := fsrepo.Open(req.Context().ConfigRoot)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
// acquire the repo lock _before_ constructing a node. we need to make
// sure we are permitted to access the resources (datastore, etc.)
repo, err := fsrepo.Open(req.Context().ConfigRoot)
ctx := req.Context()
cfg, err := ctx.GetConfig()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return