Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
fix: crash when disconnect happens during dial (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc authored and vasco-santos committed Dec 15, 2018
1 parent 54632b3 commit 894e3cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ class FloodSub extends BaseProtocol {
if (err) return callback(err)
const idB58Str = peerInfo.id.toB58String()
const peer = this.peers.get(idB58Str)
// Immediately send my own subscriptions to the newly established conn
peer.sendSubscriptions(this.subscriptions)
if (peer && peer.isWritable) {
// Immediately send my own subscriptions to the newly established conn
peer.sendSubscriptions(this.subscriptions)
}
setImmediate(() => callback())
})
}
Expand Down

0 comments on commit 894e3cc

Please sign in to comment.