Don't send null data segments

pull/22966/head
Ryan Dahl 2010-11-11 17:31:38 -08:00
parent d74c506044
commit 5ba0be6166
2 changed files with 3 additions and 0 deletions

View File

@ -244,6 +244,7 @@ Object.defineProperty(Stream.prototype, 'readyState', {
Stream.prototype._appendBucket = function (data, encoding, fd) { Stream.prototype._appendBucket = function (data, encoding, fd) {
// TODO reject empty data.
var newBucket = { data: data }; var newBucket = { data: data };
if (encoding) newBucket.encoding = encoding; if (encoding) newBucket.encoding = encoding;
if (fd) newBucket.fd = fd; if (fd) newBucket.fd = fd;

View File

@ -335,6 +335,8 @@ void IOWatcher::Dump(EV_P_ ev_prepare *w, int revents) {
size_t l = Buffer::Length(buf_object); size_t l = Buffer::Length(buf_object);
if (l == 0) continue;
assert(first_offset < l); assert(first_offset < l);
iov[iovcnt].iov_base = Buffer::Data(buf_object) + first_offset; iov[iovcnt].iov_base = Buffer::Data(buf_object) + first_offset;
iov[iovcnt].iov_len = l - first_offset; iov[iovcnt].iov_len = l - first_offset;