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
36798def
Commit
36798def
authored
10 years ago
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracking down a bug dhthell found, added asserts and better logging.
parent
b5121d63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
bitswap.go
bitswap.go
+11
-5
No files found.
bitswap.go
View file @
36798def
...
...
@@ -197,13 +197,19 @@ func (bs *bitswap) loop(parent context.Context) {
}
}
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
{
bs
.
wantlist
.
Add
(
k
)
providers
:=
bs
.
routing
.
FindProvidersAsync
(
ctx
,
k
,
maxProvidersPerRequest
)
err
:=
bs
.
sendWantListTo
(
ctx
,
providers
)
if
err
!=
nil
{
log
.
Errorf
(
"error sending wantlist: %s"
,
err
)
}
}
providers
:=
bs
.
routing
.
FindProvidersAsync
(
ctx
,
ks
[
0
],
maxProvidersPerRequest
)
err
:=
bs
.
sendWantListTo
(
ctx
,
providers
)
if
err
!=
nil
{
log
.
Errorf
(
"error sending wantlist: %s"
,
err
)
}
case
<-
parent
.
Done
()
:
return
...
...
This diff is collapsed.
Click to expand it.
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