Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cancel contexts in early returns
Browse files Browse the repository at this point in the history
whyrusleeping committed Jun 3, 2015
1 parent b70dd34 commit f155f2e
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/commands/object.go
Original file line number Diff line number Diff line change
@@ -453,6 +453,7 @@ resulting object hash.
rnode, err := nd.DAG.Get(ctx, rhash)
if err != nil {
res.SetError(err, cmds.ErrNormal)
cancel()
return
}
cancel()
@@ -595,6 +596,7 @@ func addLink(ctx context.Context, ds dag.DAGService, root *dag.Node, childname s
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
childnd, err := ds.Get(ctx, childk)
if err != nil {
cancel()
return "", err
}
cancel()
2 changes: 2 additions & 0 deletions routing/record/record.go
Original file line number Diff line number Diff line change
@@ -6,11 +6,13 @@ import (
proto "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto"

key "github.com/ipfs/go-ipfs/blocks/key"
dag "github.com/ipfs/go-ipfs/merkledag"
ci "github.com/ipfs/go-ipfs/p2p/crypto"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
)

var _ = dag.FetchGraph
var log = eventlog.Logger("routing/record")

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

0 comments on commit f155f2e

Please sign in to comment.