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
p2p
go-p2p-kad-dht
Commits
4e793b15
Commit
4e793b15
authored
Dec 05, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: respect ctx on receive
@jbenet License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
88f4481c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
providers.go
providers.go
+6
-1
No files found.
providers.go
View file @
4e793b15
...
...
@@ -107,10 +107,15 @@ func (pm *ProviderManager) GetProviders(ctx context.Context, k u.Key) []peer.Pee
resp
:
make
(
chan
[]
peer
.
Peer
,
1
),
// buffered to prevent sender from blocking
}
select
{
case
<-
ctx
.
Done
()
:
return
nil
case
pm
.
getprovs
<-
gp
:
return
<-
gp
.
resp
}
select
{
case
<-
ctx
.
Done
()
:
return
nil
case
peers
:=
<-
gp
.
resp
:
return
peers
}
}
...
...
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