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 f155f2e

Browse files
committedJun 3, 2015
cancel contexts in early returns
1 parent b70dd34 commit f155f2e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
 

‎core/commands/object.go

+2
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ resulting object hash.
453453
rnode, err := nd.DAG.Get(ctx, rhash)
454454
if err != nil {
455455
res.SetError(err, cmds.ErrNormal)
456+
cancel()
456457
return
457458
}
458459
cancel()
@@ -595,6 +596,7 @@ func addLink(ctx context.Context, ds dag.DAGService, root *dag.Node, childname s
595596
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
596597
childnd, err := ds.Get(ctx, childk)
597598
if err != nil {
599+
cancel()
598600
return "", err
599601
}
600602
cancel()

‎routing/record/record.go

+2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import (
66
proto "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
77

88
key "github.com/ipfs/go-ipfs/blocks/key"
9+
dag "github.com/ipfs/go-ipfs/merkledag"
910
ci "github.com/ipfs/go-ipfs/p2p/crypto"
1011
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
1112
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
1213
)
1314

15+
var _ = dag.FetchGraph
1416
var log = eventlog.Logger("routing/record")
1517

1618
// MakePutRecord creates and signs a dht record for the given key/value pair

0 commit comments

Comments
 (0)
Please sign in to comment.