Commit 07b32137 authored by Brian Tiger Chow's avatar Brian Tiger Chow

refac(exchange) replace timeout -> context in API

parent 7c577eb5
...@@ -4,12 +4,13 @@ import ( ...@@ -4,12 +4,13 @@ import (
"fmt" "fmt"
"time" "time"
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go" ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
blocks "github.com/jbenet/go-ipfs/blocks" blocks "github.com/jbenet/go-ipfs/blocks"
exchange "github.com/jbenet/go-ipfs/exchange" exchange "github.com/jbenet/go-ipfs/exchange"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
) )
// BlockService is a block datastore. // BlockService is a block datastore.
...@@ -65,7 +66,8 @@ func (s *BlockService) GetBlock(k u.Key) (*blocks.Block, error) { ...@@ -65,7 +66,8 @@ func (s *BlockService) GetBlock(k u.Key) (*blocks.Block, error) {
}, nil }, nil
} else if err == ds.ErrNotFound && s.Remote != nil { } else if err == ds.ErrNotFound && s.Remote != nil {
u.DOut("Blockservice: Searching bitswap.\n") u.DOut("Blockservice: Searching bitswap.\n")
blk, err := s.Remote.Block(k, time.Second*5) ctx, _ := context.WithTimeout(context.TODO(), 5*time.Second)
blk, err := s.Remote.Block(ctx, k)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment