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 Feb 5, 2019
1 parent ab028a2 commit e71e2b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"libp2p-circuit": "~0.3.0",
"libp2p-delegated-content-routing": "~0.2.2",
"libp2p-delegated-peer-routing": "~0.2.2",
"libp2p-kad-dht": "~0.14.2",
"libp2p-kad-dht": "~0.14.5",
"libp2p-mdns": "~0.12.0",
"libp2p-mplex": "~0.8.4",
"libp2p-secio": "~0.11.0",
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,10 @@ 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 e71e2b6

Please sign in to comment.