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-dms3
Commits
836e5cab
Commit
836e5cab
authored
Jan 11, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #539 from jbenet/bitswap/tweak
early out if no entries in wantlist
parents
456719ed
a09854db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
exchange/bitswap/bitswap.go
exchange/bitswap/bitswap.go
+7
-1
No files found.
exchange/bitswap/bitswap.go
View file @
836e5cab
...
...
@@ -225,6 +225,12 @@ func (bs *bitswap) sendWantlistToPeers(ctx context.Context, peers <-chan peer.ID
}
func
(
bs
*
bitswap
)
sendWantlistToProviders
(
ctx
context
.
Context
)
{
entries
:=
bs
.
wantlist
.
Entries
()
if
len
(
entries
)
==
0
{
log
.
Debug
(
"No entries in wantlist, skipping send routine."
)
return
}
log
:=
log
.
Prefix
(
"bitswap(%s).sendWantlistToProviders "
,
bs
.
self
)
log
.
Debugf
(
"begin"
)
defer
log
.
Debugf
(
"end"
)
...
...
@@ -237,7 +243,7 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
// Get providers for all entries in wantlist (could take a while)
wg
:=
sync
.
WaitGroup
{}
for
_
,
e
:=
range
bs
.
wantlist
.
E
ntries
()
{
for
_
,
e
:=
range
e
ntries
{
wg
.
Add
(
1
)
go
func
(
k
u
.
Key
)
{
defer
wg
.
Done
()
...
...
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