Skip to content

Commit

Permalink
adjust logic to respect size of the array
Browse files Browse the repository at this point in the history
  • Loading branch information
cortze committed Dec 7, 2022
1 parent 0428dec commit f0f2434
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key multihash
psLock.Lock()
defer psLock.Unlock()
pi, ok := ps[p.ID]
if (!ok && (len(ps) < count || findAll)) || ((len(pi.Addrs) == 0) && len(p.Addrs) > 0) {
if (!ok || ((len(pi.Addrs) == 0) && len(p.Addrs) > 0)) && (len(ps) < count || findAll) {
ps[p.ID] = p
return true
}
Expand Down

0 comments on commit f0f2434

Please sign in to comment.