Don't append buckets of zero length

This commit is contained in:
Ryan Dahl 2010-11-12 11:47:31 -08:00
parent 10ff559ec3
commit 5d6a03c9fe

View File

@ -249,6 +249,7 @@ Object.defineProperty(Stream.prototype, 'readyState', {
Stream.prototype._appendBucket = function (data, encoding, fd) { Stream.prototype._appendBucket = function (data, encoding, fd) {
if (data.length != 0) {
// TODO reject empty data. // TODO reject empty data.
var newBucket = { data: data }; var newBucket = { data: data };
if (encoding) newBucket.encoding = encoding; if (encoding) newBucket.encoding = encoding;
@ -263,6 +264,7 @@ Stream.prototype._appendBucket = function (data, encoding, fd) {
} }
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;