From: Ryan Dahl Date: Tue, 27 Apr 2010 03:26:43 +0000 (-0700) Subject: Fix bug in socket write optimization X-Git-Tag: v0.1.93~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e235aae0181d7b3b47951d33616f5b007075acf5;p=platform%2Fupstream%2Fnodejs.git Fix bug in socket write optimization Thanks to tlb@tlb.org for finding it! --- diff --git a/lib/net.js b/lib/net.js index be49783..04ca00f 100644 --- a/lib/net.js +++ b/lib/net.js @@ -624,7 +624,12 @@ Stream.prototype._writeOut = function (data, encoding) { if (bytesWritten == len) { // awesome. sent to buffer. - buffer.used -= len; // Optimization - save the space + if (buffer === pool) { + // If we're just writing from the pool then we can make a little + // optimization and save the space. + buffer.used -= len; + } + if (queuedData) { return false; } else {