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
499aa2c3
Commit
499aa2c3
authored
Nov 20, 2014
by
Brian Tiger Chow
Committed by
Jeromy
Dec 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(bitswap) loop over all provided keys
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
36ebde35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
bitswap.go
bitswap.go
+5
-11
No files found.
bitswap.go
View file @
499aa2c3
...
@@ -182,19 +182,13 @@ func (bs *bitswap) run(ctx context.Context) {
...
@@ -182,19 +182,13 @@ func (bs *bitswap) run(ctx context.Context) {
}
}
}
}
case
ks
:=
<-
bs
.
batchRequests
:
case
ks
:=
<-
bs
.
batchRequests
:
// TODO: implement batching on len(ks) > X for some X
if
len
(
ks
)
==
0
{
log
.
Warning
(
"Received batch request for zero blocks"
)
continue
}
for
_
,
k
:=
range
ks
{
for
_
,
k
:=
range
ks
{
bs
.
wantlist
.
Add
(
k
)
bs
.
wantlist
.
Add
(
k
)
}
providers
:=
bs
.
routing
.
FindProvidersAsync
(
ctx
,
k
,
maxProvidersPerRequest
)
providers
:=
bs
.
routing
.
FindProvidersAsync
(
ctx
,
ks
[
0
],
maxProvidersPerRequest
)
err
:=
bs
.
sendWantListTo
(
ctx
,
providers
)
if
err
!=
nil
{
err
:=
bs
.
sendWantListTo
(
ctx
,
providers
)
log
.
Errorf
(
"error sending wantlist: %s"
,
err
)
if
err
!=
nil
{
}
log
.
Errorf
(
"error sending wantlist: %s"
,
err
)
}
}
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
return
return
...
...
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