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

Async Refactor: providers #133

Merged
merged 4 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"merge-options": "^1.0.1",
"multihashes": "~0.4.14",
"multihashing-async": "~0.5.2",
"p-queue": "^5.0.0",
"peer-id": "~0.12.2",
"peer-info": "~0.15.1",
"priorityqueue": "~0.2.1",
Expand All @@ -62,6 +63,7 @@
"protons": "^1.0.1",
"pull-length-prefixed": "^1.3.2",
"pull-stream": "^3.6.9",
"pull-stream-to-async-iterator": "^1.0.1",
"varint": "^5.0.0",
"xor-distance": "^2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ class KadDHT extends EventEmitter {

const errors = []
waterfall([
(cb) => this.providers.addProvider(key, this.peerInfo.id, cb),
(cb) => promiseToCallback(this.providers.addProvider(key, this.peerInfo.id))(err => cb(err)),
kumavis marked this conversation as resolved.
Show resolved Hide resolved
(cb) => this.getClosestPeers(key.buffer, cb),
(peers, cb) => {
const msg = new Message(Message.TYPES.ADD_PROVIDER, key.buffer, 0)
Expand Down
2 changes: 1 addition & 1 deletion src/private.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ module.exports = (dht) => ({
async _findNProvidersAsync (key, providerTimeout, n) {
const out = new LimitedPeerList(n)

const provs = await promisify(cb => dht.providers.getProviders(key, cb))()
const provs = await dht.providers.getProviders(key)

provs.forEach((id) => {
let info
Expand Down
Loading