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
ba86f518
Commit
ba86f518
authored
Dec 06, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: return a closed channel from FindProvidersAsync when providers are disabled.
parent
c2b72b25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
routing.go
routing.go
+3
-2
No files found.
routing.go
View file @
ba86f518
...
...
@@ -509,12 +509,13 @@ func (dht *IpfsDHT) FindProviders(ctx context.Context, c cid.Cid) ([]peer.AddrIn
// Peers will be returned on the channel as soon as they are found, even before
// the search query completes.
func
(
dht
*
IpfsDHT
)
FindProvidersAsync
(
ctx
context
.
Context
,
key
cid
.
Cid
,
count
int
)
<-
chan
peer
.
AddrInfo
{
peerOut
:=
make
(
chan
peer
.
AddrInfo
,
count
)
if
!
dht
.
enableProviders
{
return
nil
close
(
peerOut
)
return
peerOut
}
logger
.
Event
(
ctx
,
"findProviders"
,
key
)
peerOut
:=
make
(
chan
peer
.
AddrInfo
,
count
)
go
dht
.
findProvidersAsyncRoutine
(
ctx
,
key
,
count
,
peerOut
)
return
peerOut
...
...
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