Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 46b8ba8

Browse files
committedJan 11, 2016
use correct context in pubfunc pinning
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent 85852b5 commit 46b8ba8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎core/core.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -475,15 +475,15 @@ func (n *IpfsNode) loadFilesRoot() error {
475475
dsk := ds.NewKey("/local/filesroot")
476476
pf := func(ctx context.Context, k key.Key) error {
477477
ds := n.Repo.Datastore()
478-
if old, err := ds.Get(dsk); err == nil {
479-
_ = n.Pinning.Unpin(n.Context(), key.Key(old.([]byte)), true)
478+
if old, err := ds.Get(dsk); err == nil && old != nil {
479+
_ = n.Pinning.Unpin(ctx, key.Key(old.([]byte)), true)
480480
}
481-
nnd, err := n.DAG.Get(n.Context(), k)
481+
nnd, err := n.DAG.Get(ctx, k)
482482
if err != nil {
483483
return err
484484
}
485485

486-
if err := n.Pinning.Pin(n.Context(), nnd, true); err != nil {
486+
if err := n.Pinning.Pin(ctx, nnd, true); err != nil {
487487
return err
488488
}
489489

‎mfs/ops.go

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func Mkdir(r *Root, pth string, mkparents bool, flush bool) error {
162162
func Lookup(r *Root, path string) (FSNode, error) {
163163
dir, ok := r.GetValue().(*Directory)
164164
if !ok {
165+
log.Error("root not a dir: %#v", r.GetValue())
165166
return nil, errors.New("root was not a directory")
166167
}
167168

0 commit comments

Comments
 (0)
Please sign in to comment.