Skip to content

Commit

Permalink
feat: not remove peer from peerBook on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Mar 30, 2017
1 parent 291e79f commit acbf21f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class Node extends EventEmitter {

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

Expand Down Expand Up @@ -163,7 +161,12 @@ class Node extends EventEmitter {

dial (peer, protocol, callback) {
assert(this.isOn(), OFFLINE_ERROR_MESSAGE)
const peerInfo = this._getPeerInfo(peer)
let peerInfo
try {
peerInfo = this._getPeerInfo(peer)
} catch (err) {
return callback(err)
}

if (typeof protocol === 'function') {
callback = protocol
Expand Down

0 comments on commit acbf21f

Please sign in to comment.