Skip to content

Commit

Permalink
fix: handling not connecting by emitting disconnect event. Should fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte committed Dec 12, 2017
1 parent 5c6ac5a commit 2a1b2b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ module.exports = class Connection extends EventEmitter {
}

if (!peerAddresses.length) {
this.emit('error', new Error('could not connect to ' + this._id))
this.emit('disconnect')
return // early
}

this._ipfs._libp2pNode.dial(peerAddresses[0], PROTOCOL, (err, conn) => {
if (err) {
this.emit('error', err)
this.emit('disconnect')
return // early
}
this._connecting = false
Expand Down

0 comments on commit 2a1b2b7

Please sign in to comment.