Don't append buckets of zero length
This commit is contained in:
parent
10ff559ec3
commit
5d6a03c9fe
24
lib/net.js
24
lib/net.js
@ -249,21 +249,23 @@ Object.defineProperty(Stream.prototype, 'readyState', {
|
|||||||
|
|
||||||
|
|
||||||
Stream.prototype._appendBucket = function (data, encoding, fd) {
|
Stream.prototype._appendBucket = function (data, encoding, fd) {
|
||||||
// TODO reject empty data.
|
if (data.length != 0) {
|
||||||
var newBucket = { data: data };
|
// TODO reject empty data.
|
||||||
if (encoding) newBucket.encoding = encoding;
|
var newBucket = { data: data };
|
||||||
if (fd) newBucket.fd = fd;
|
if (encoding) newBucket.encoding = encoding;
|
||||||
|
if (fd) newBucket.fd = fd;
|
||||||
|
|
||||||
// TODO properly calculate queueSize
|
// TODO properly calculate queueSize
|
||||||
|
|
||||||
if (this._writeWatcher.lastBucket) {
|
if (this._writeWatcher.lastBucket) {
|
||||||
this._writeWatcher.lastBucket.next = newBucket;
|
this._writeWatcher.lastBucket.next = newBucket;
|
||||||
} else {
|
} else {
|
||||||
this._writeWatcher.firstBucket = newBucket;
|
this._writeWatcher.firstBucket = newBucket;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._writeWatcher.lastBucket = newBucket;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._writeWatcher.lastBucket = newBucket;
|
|
||||||
|
|
||||||
if (this._writeWatcher.queueSize === undefined) {
|
if (this._writeWatcher.queueSize === undefined) {
|
||||||
this._writeWatcher.queueSize = 0;
|
this._writeWatcher.queueSize = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user