Skip to content

Commit e71e2b6

Browse files
committed
fix: emit peer discovery for dht discovery
1 parent ab028a2 commit e71e2b6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"libp2p-circuit": "~0.3.0",
7373
"libp2p-delegated-content-routing": "~0.2.2",
7474
"libp2p-delegated-peer-routing": "~0.2.2",
75-
"libp2p-kad-dht": "~0.14.2",
75+
"libp2p-kad-dht": "~0.14.5",
7676
"libp2p-mdns": "~0.12.0",
7777
"libp2p-mplex": "~0.8.4",
7878
"libp2p-secio": "~0.11.0",

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ class Node extends EventEmitter {
404404
// have to set started here because DHT requires libp2p is already started
405405
this._isStarted = true
406406
if (this._dht) {
407-
this._dht.start(cb)
407+
this._dht.start(() => {
408+
this._dht.on('peer', (peerInfo) => this.emit('peer:discovery', peerInfo))
409+
cb()
410+
})
408411
} else {
409412
cb()
410413
}

0 commit comments

Comments
 (0)