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
f91baafb
Commit
f91baafb
authored
Mar 07, 2015
by
Henry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed two more
parent
006dd2ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
workers.go
workers.go
+4
-2
No files found.
workers.go
View file @
f91baafb
...
@@ -68,11 +68,12 @@ func (bs *Bitswap) provideWorker(ctx context.Context) {
...
@@ -68,11 +68,12 @@ func (bs *Bitswap) provideWorker(ctx context.Context) {
log
.
Debug
(
"provideKeys channel closed"
)
log
.
Debug
(
"provideKeys channel closed"
)
return
return
}
}
ctx
,
_
:=
context
.
WithTimeout
(
ctx
,
provideTimeout
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
provideTimeout
)
err
:=
bs
.
network
.
Provide
(
ctx
,
k
)
err
:=
bs
.
network
.
Provide
(
ctx
,
k
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
}
}
cancel
()
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
return
return
}
}
...
@@ -136,12 +137,13 @@ func (bs *Bitswap) clientWorker(parent context.Context) {
...
@@ -136,12 +137,13 @@ func (bs *Bitswap) clientWorker(parent context.Context) {
// NB: Optimization. Assumes that providers of key[0] are likely to
// NB: Optimization. Assumes that providers of key[0] are likely to
// be able to provide for all keys. This currently holds true in most
// be able to provide for all keys. This currently holds true in most
// every situation. Later, this assumption may not hold as true.
// every situation. Later, this assumption may not hold as true.
child
,
_
:=
context
.
WithTimeout
(
req
.
ctx
,
providerRequestTimeout
)
child
,
cancel
:=
context
.
WithTimeout
(
req
.
ctx
,
providerRequestTimeout
)
providers
:=
bs
.
network
.
FindProvidersAsync
(
child
,
keys
[
0
],
maxProvidersPerRequest
)
providers
:=
bs
.
network
.
FindProvidersAsync
(
child
,
keys
[
0
],
maxProvidersPerRequest
)
err
:=
bs
.
sendWantlistToPeers
(
req
.
ctx
,
providers
)
err
:=
bs
.
sendWantlistToPeers
(
req
.
ctx
,
providers
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Debugf
(
"error sending wantlist: %s"
,
err
)
log
.
Debugf
(
"error sending wantlist: %s"
,
err
)
}
}
cancel
()
// Wait for wantNewBlocks to finish
// Wait for wantNewBlocks to finish
<-
done
<-
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