Skip to content

Commit

Permalink
fix: avoid deleting nodes from peerBook
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Mar 29, 2017
1 parent 9f4ec2a commit 300936f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ class Node extends EventEmitter {
// If muxer exists, we can use Identify
this.swarm.connection.reuse()

// Received incommind dial and muxer upgrade happened, reuse this
// muxed connection
// Received incommind dial and muxer upgrade happened,
// reuse this muxed connection
this.swarm.on('peer-mux-established', (peerInfo) => {
this.emit('peer:connect', peerInfo)
this.peerBook.put(peerInfo)
})

this.swarm.on('peer-mux-closed', (peerInfo) => {
this.emit('peer:disconnect', peerInfo)
this.peerBook.removeByB58String(peerInfo.id.toB58String())
})
}

Expand Down

0 comments on commit 300936f

Please sign in to comment.