|
@ -472,10 +472,11 @@ function onread(buffer, offset, length) { |
|
|
self.bytesRead += length; |
|
|
self.bytesRead += length; |
|
|
|
|
|
|
|
|
// Optimization: emit the original buffer with end points
|
|
|
// Optimization: emit the original buffer with end points
|
|
|
|
|
|
var ret = true; |
|
|
if (self.ondata) self.ondata(buffer, offset, end); |
|
|
if (self.ondata) self.ondata(buffer, offset, end); |
|
|
else self._readableState.onread(null, buffer.slice(offset, end)); |
|
|
else ret = self.push(buffer.slice(offset, end)); |
|
|
|
|
|
|
|
|
if (handle.reading && !self._readableState.reading) { |
|
|
if (handle.reading && !ret) { |
|
|
handle.reading = false; |
|
|
handle.reading = false; |
|
|
debug('readStop'); |
|
|
debug('readStop'); |
|
|
var r = handle.readStop(); |
|
|
var r = handle.readStop(); |
|
@ -492,7 +493,7 @@ function onread(buffer, offset, length) { |
|
|
if (self.onend) self.once('end', self.onend); |
|
|
if (self.onend) self.once('end', self.onend); |
|
|
|
|
|
|
|
|
// send a null to the _read cb to signal the end of data.
|
|
|
// send a null to the _read cb to signal the end of data.
|
|
|
self._readableState.onread(null, null); |
|
|
self.push(null); |
|
|
|
|
|
|
|
|
// internal end event so that we know that the actual socket
|
|
|
// internal end event so that we know that the actual socket
|
|
|
// is no longer readable, and we can start the shutdown
|
|
|
// is no longer readable, and we can start the shutdown
|
|
|