Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: _findNProvidersAsync discarding search results (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qmstream authored and vasco-santos committed Jul 29, 2019
1 parent c9093c4 commit e656c6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/private.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ module.exports = (dht) => ({
promiseToCallback(query.run(peers))(cb)
}, providerTimeout)(callback))()
} catch (err) {
if (err.code !== 'ETIMEDOUT' || out.length === 0) {
if (err.code !== 'ETIMEDOUT') {
throw err
}
} finally {
Expand All @@ -577,6 +577,10 @@ module.exports = (dht) => ({
})
})

if (out.length === 0) {
throw errcode(new Error('no providers found'), 'ERR_NOT_FOUND')
}

return out.toArray()
},

Expand Down

0 comments on commit e656c6b

Please sign in to comment.