From 48e2f6f38b67b6235b78fec7c5ead082e294ffb7 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Mon, 6 Apr 2020 17:28:13 +0200 Subject: [PATCH] chore: peer-discovery not using peer-info BREAKING CHANGE: peer event emitted with id and multiaddrs properties instead of peer-info --- src/index.js | 7 +++++-- src/query/workerQueue.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 21f295a2..953dd123 100644 --- a/src/index.js +++ b/src/index.js @@ -305,8 +305,11 @@ class KadDHT extends EventEmitter { // ----------- Discovery ----------- - _peerDiscovered (peerInfo) { - this.emit('peer', peerInfo) + _peerDiscovered (peerId, multiaddrs) { + this.emit('peer', { + id: peerId, + multiaddrs + }) } // ----------- Internals ----------- diff --git a/src/query/workerQueue.js b/src/query/workerQueue.js index cc2e3516..0c886b88 100644 --- a/src/query/workerQueue.js +++ b/src/query/workerQueue.js @@ -244,7 +244,7 @@ class WorkerQueue { if (this.dht._isSelf(closer.id)) { return } - this.dht._peerDiscovered(closer) + this.dht._peerDiscovered(closer.id, closer.multiaddrs.toArray()) await this.path.addPeerToQuery(closer.id) })) }