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
ca09167b
Unverified
Commit
ca09167b
authored
Apr 09, 2020
by
Will Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug in count=0 findProviders
parent
a366d8b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
dual/dual.go
dual/dual.go
+2
-1
No files found.
dual/dual.go
View file @
ca09167b
...
...
@@ -95,13 +95,14 @@ func (dht *DHT) FindProvidersAsync(ctx context.Context, key cid.Cid, count int)
outCh
:=
make
(
chan
peer
.
AddrInfo
)
wanCh
:=
dht
.
WAN
.
FindProvidersAsync
(
reqCtx
,
key
,
count
)
lanCh
:=
dht
.
LAN
.
FindProvidersAsync
(
reqCtx
,
key
,
count
)
zeroCount
:=
(
count
==
0
)
go
func
()
{
defer
cancel
()
defer
close
(
outCh
)
found
:=
make
(
map
[
peer
.
ID
]
struct
{},
count
)
var
pi
peer
.
AddrInfo
for
count
>
0
&&
(
wanCh
!=
nil
||
lanCh
!=
nil
)
{
for
(
zeroCount
||
count
>
0
)
&&
(
wanCh
!=
nil
||
lanCh
!=
nil
)
{
var
ok
bool
select
{
case
pi
,
ok
=
<-
wanCh
:
...
...
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