Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
fix: destroy streams on end (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun authored Mar 25, 2019
1 parent 20198d1 commit 4b1ebc7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/muxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module.exports = class Muxer extends EventEmitter {
if (didError && /ok/i.test(didError.message)) {
didError = false
}
spdy.destroyStreams(new Error('underlying socket has been closed'))
this.emit('close', didError)
})

Expand Down Expand Up @@ -103,10 +102,9 @@ module.exports = class Muxer extends EventEmitter {
}

end (cb) {
cb = once(cb || noop)
this.spdy.once('error', (err) => {
cb(err)
})
cb = cb ? once(cb) : noop
this.spdy.once('error', cb)
this.spdy.destroyStreams()
this.spdy.end((err) => {
if (err && /ok/i.test(err.message)) {
return cb()
Expand Down

0 comments on commit 4b1ebc7

Please sign in to comment.