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
5575419b
Commit
5575419b
authored
Sep 05, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitswap: search for wantlist providers a little less often
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
b78786db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
workers.go
workers.go
+8
-8
No files found.
workers.go
View file @
5575419b
package
bitswap
import
(
"math/rand"
"sync"
"time"
...
...
@@ -175,15 +176,14 @@ func (bs *Bitswap) rebroadcastWorker(parent context.Context) {
if
len
(
entries
)
==
0
{
continue
}
tctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
providerRequestTimeout
)
for
_
,
e
:=
range
bs
.
wm
.
wl
.
Entries
()
{
e
:=
e
bs
.
findKeys
<-
&
blockRequest
{
Key
:
e
.
Key
,
Ctx
:
tctx
,
}
// TODO: come up with a better strategy for determining when to search
// for new providers for blocks.
i
:=
rand
.
Intn
(
len
(
entries
))
bs
.
findKeys
<-
&
blockRequest
{
Key
:
entries
[
i
]
.
Key
,
Ctx
:
ctx
,
}
cancel
()
case
<-
parent
.
Done
()
:
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