From cf2e68d960750dbe36367463168764d7a32ddcb9 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 22 Aug 2011 15:03:27 -0700 Subject: [PATCH] net_uv: handle read errors --- lib/net_uv.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/net_uv.js b/lib/net_uv.js index 4476823873..7a97e46e21 100644 --- a/lib/net_uv.js +++ b/lib/net_uv.js @@ -300,7 +300,7 @@ function onread(buffer, offset, length) { // Optimization: emit the original buffer with end points if (self.ondata) self.ondata(buffer, offset, end); - } else { + } else if (errno == 'EOF') { // EOF self.readable = false; @@ -314,6 +314,9 @@ function onread(buffer, offset, length) { if (!self.allowHalfOpen) self.end(); if (self._events && self._events['end']) self.emit('end'); if (self.onend) self.onend(); + } else { + // Error + self.destroy(errnoException(errno, 'read')); } }