Commit 978a60f7 authored by Brian Tiger Chow's avatar Brian Tiger Chow

refac(routing) replace timeout -> ctx

@jbenet oh hai there!
parent bb111846
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
type Routing interface { type Routing interface {
// FindProvidersAsync returns a channel of providers for the given key // FindProvidersAsync returns a channel of providers for the given key
// TODO replace with timeout with context // TODO replace with timeout with context
FindProvidersAsync(u.Key, int, time.Duration) <-chan *peer.Peer FindProvidersAsync(context.Context, u.Key, int) <-chan *peer.Peer
// Provide provides the key to the network // Provide provides the key to the network
Provide(key u.Key) error Provide(key u.Key) error
...@@ -74,7 +74,7 @@ func (bs *bitswap) Block(k u.Key, timeout time.Duration) ( ...@@ -74,7 +74,7 @@ func (bs *bitswap) Block(k u.Key, timeout time.Duration) (
// TODO replace timeout with ctx in routing interface // TODO replace timeout with ctx in routing interface
begin := time.Now() begin := time.Now()
tleft := timeout - time.Now().Sub(begin) tleft := timeout - time.Now().Sub(begin)
provs_ch := bs.routing.FindProvidersAsync(k, 20, timeout) provs_ch := bs.routing.FindProvidersAsync(ctx, k, 20)
blockChannel := make(chan blocks.Block) blockChannel := make(chan blocks.Block)
after := time.After(tleft) after := time.After(tleft)
......
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