Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
978a60f7
Commit
978a60f7
authored
Sep 18, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refac(routing) replace timeout -> ctx
@jbenet oh hai there!
parent
bb111846
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
bitswap.go
bitswap.go
+2
-2
No files found.
bitswap.go
View file @
978a60f7
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment