From 544877d12e24b84917d2358caedc00be1538bbe9 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 18 Nov 2010 11:59:15 -0800 Subject: [PATCH] Fix socket.end() problem on non-empty queue --- lib/net.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/net.js b/lib/net.js index 38b804eb43e..50cfc293cd1 100644 --- a/lib/net.js +++ b/lib/net.js @@ -73,7 +73,9 @@ IOWatcher.prototype.ondrain = function () { IOWatcher.prototype.onerror = function (errno) { assert(this.socket); - this.socket.destroy(errnoException(errno, 'write')); + var e = errnoException(errno, 'write'); + e.message += " fd=" + this.socket.fd; + this.socket.destroy(e); }; @@ -613,7 +615,7 @@ Stream.prototype.end = function (data, encoding) { this._eof = true; // If this isn't in the dumpQueue then we shutdown now. - if (!this._writeWatcher.next) this._shutdown(); + if (!this._writeWatcher.firstBucket) this._shutdown(); };