Permalink
Browse files

Only try to flush big buffers once

  • Loading branch information...
1 parent 996175e commit 31ea1f4bb01dedbe3ebaa48bf0cbb017c5ffcee7 @ry ry committed Nov 18, 2010
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/net.js
View
@@ -59,6 +59,8 @@ IOWatcher.prototype.ondrain = function () {
if (this.socket) {
var socket = this.socket;
+ socket._haveTriedFlush = false;
+
if (socket.writable || socket.readable) {
require('timers').active(socket);
}
@@ -327,8 +329,9 @@ Stream.prototype.write = function (data /* encoding, fd, callback */) {
this._onWritable(); // Insert writeWatcher into the dumpQueue
require('timers').active(this);
- if (queueSize > (64*1024)) {
+ if (queueSize > (64*1024) && !this._haveTriedFlush) {
IOWatcher.flush();
+ this._haveTriedFlush = true;
}
return queueSize < (64*1024);

0 comments on commit 31ea1f4

Please sign in to comment.