Skip to content

Commit

Permalink
fix: emit peer discovery for dht discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Dec 28, 2018
1 parent 26de739 commit e01f01e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,12 @@ class Node extends EventEmitter {
// have to set started here because DHT requires libp2p is already started
this._isStarted = true
if (this._dht) {
this._dht.start(cb)
this._dht.start(() => {
this._dht.on('peer', (peerInfo) => {
this.emit('peer:discovery', peerInfo)
})
cb()
})
} else {
cb()
}
Expand Down

0 comments on commit e01f01e

Please sign in to comment.