@cryptotaxi247 / kubo / commits / d9783d998

teach pinning how to use GetBlocks

Jeromy committed Feb 18, 2015 at 08:33 UTC d9783d998a61b30eceea65975bed7dff216cc5cf
1 file changed +6 -2
pin/pin.go
+6 -2
@@ -7,7 +7,9 @@ import (
7 "errors"
8 "fmt"
9 "sync"
10 + "time"
11
12 + context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
13 ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
14 nsds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/namespace"
15 "github.com/jbenet/go-ipfs/blocks/set"
@@ -170,8 +172,10 @@ func (p *pinner) pinIndirectRecurse(node *mdag.Node) error {
172 }
173
174 func (p *pinner) pinLinks(node *mdag.Node) error {
173 - for _, l := range node.Links {
174 - subnode, err := l.GetNode(p.dserv)
175 + ctx, _ := context.WithTimeout(context.Background(), time.Second*60)
176 + for _, ng := range p.dserv.GetDAG(ctx, node) {
177 + subnode, err := ng.Get()
178 + //subnode, err := l.GetNode(p.dserv)
179 if err != nil {
180 // TODO: Maybe just log and continue?
181 return err