Comparing version 7.0.20 to 8.0.0
32
index.js
@@ -229,3 +229,3 @@ /** | ||
When the first stream's is paused, backpressure is applied to the second stream | ||
When the first stream is paused, backpressure is applied to the second stream | ||
too, even though it hasn't been paused. If you run this example, you'll see: | ||
@@ -404,2 +404,16 @@ | ||
this.on('close', function () | ||
{ | ||
var was_finished = this._finished; | ||
this._finished = true; | ||
this._ended = true; | ||
if (!was_finished) | ||
{ | ||
this._mux._send_end(this); | ||
} | ||
// don't call _check_remove because this may be due to a local | ||
// destroy and so data may still come from peer (but be ignored | ||
// because we don't push to destroyed streams) | ||
}); | ||
mux.duplexes.set(chan, this); | ||
@@ -559,5 +573,5 @@ | ||
{ | ||
if (!duplex._finished) | ||
if (!duplex._finished && !duplex.destroyed) | ||
{ | ||
duplex.emit('error', new Error('carrier stream finished before duplex finished')); | ||
duplex.destroy(new Error('carrier stream finished before duplex finished')); | ||
} | ||
@@ -576,5 +590,5 @@ } | ||
{ | ||
if (!duplex._ended) | ||
if (!duplex._ended && !duplex.destroyed) | ||
{ | ||
duplex.emit('error', new Error('carrier stream ended before end message received')); | ||
duplex.destroy(new Error('carrier stream ended before end message received')); | ||
} | ||
@@ -596,3 +610,5 @@ } | ||
{ | ||
if (EventEmitter.listenerCount(duplex, 'error') > 0) | ||
if ((EventEmitter.listenerCount(duplex, 'error') > 0) && | ||
!(duplex._finished && duplex._ended) && | ||
!duplex.destroyed) | ||
{ | ||
@@ -633,3 +649,3 @@ duplex.emit('error', err); | ||
if (!duplex._readableState.ended) | ||
if (!duplex._readableState.ended && !duplex.destroyed) | ||
{ | ||
@@ -854,3 +870,2 @@ if (duplex._check_read_overflow && | ||
duplex.push(null); | ||
duplex._end_pending = false; | ||
} | ||
@@ -862,3 +877,2 @@ else if (duplex._end_pending) | ||
duplex.push(null); | ||
duplex._end_pending = false; | ||
} | ||
@@ -865,0 +879,0 @@ this._send(); |
{ | ||
"name": "bpmux", | ||
"description": "Node stream multiplexing with back-pressure on each stream", | ||
"version": "7.0.20", | ||
"version": "8.0.0", | ||
"homepage": "https://github.com/davedoesdev/bpmux", | ||
@@ -42,3 +42,3 @@ "author": { | ||
"engines": { | ||
"node": ">= 8" | ||
"node": ">= 12" | ||
}, | ||
@@ -45,0 +45,0 @@ "dependencies": { |
@@ -223,8 +223,8 @@ # bpmux [![Build Status](https://travis-ci.org/davedoesdev/bpmux.png)](https://travis-ci.org/davedoesdev/bpmux) [![Coverage Status](https://coveralls.io/repos/davedoesdev/bpmux/badge.png?branch=master&service=github)](https://coveralls.io/r/davedoesdev/bpmux?branch=master) [![NPM version](https://badge.fury.io/js/bpmux.png)](http://badge.fury.io/js/bpmux) | ||
fs.createReadStream('/dev/urandom').pipe(stream1) | ||
fs.createReadStream('/dev/urandom').pipe(stream2) | ||
fs.createReadStream('/dev/urandom').pipe(stream1); | ||
fs.createReadStream('/dev/urandom').pipe(stream2); | ||
}); | ||
``` | ||
When the first stream's is paused, backpressure is applied to the second stream | ||
When the first stream is paused, backpressure is applied to the second stream | ||
too, even though it hasn't been paused. If you run this example, you'll see: | ||
@@ -264,4 +264,4 @@ | ||
fs.createReadStream('/dev/urandom').pipe(stream1) | ||
fs.createReadStream('/dev/urandom').pipe(stream2) | ||
fs.createReadStream('/dev/urandom').pipe(stream1); | ||
fs.createReadStream('/dev/urandom').pipe(stream2); | ||
}); | ||
@@ -268,0 +268,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
524606
5009