mirror of https://github.com/nodejs/node.git
http: cork/uncork before flushing pipelined res
Make sure that the pipelined response data will be written as less TCP packets as possible. PR-URL: https://github.com/nodejs/node/pull/3172 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Trevor Norris <trev.norris@gmail.com>pull/3172/merge
parent
d1f24044b9
commit
184f09dbe4
|
@ -161,10 +161,12 @@ OutgoingMessage.prototype._writeRaw = function(data, encoding, callback) {
|
|||
var output = this.output;
|
||||
var outputEncodings = this.outputEncodings;
|
||||
var outputCallbacks = this.outputCallbacks;
|
||||
connection.cork();
|
||||
for (var i = 0; i < outputLength; i++) {
|
||||
connection.write(output[i], outputEncodings[i],
|
||||
outputCallbacks[i]);
|
||||
}
|
||||
connection.uncork();
|
||||
|
||||
this.output = [];
|
||||
this.outputEncodings = [];
|
||||
|
@ -651,10 +653,12 @@ OutgoingMessage.prototype._flush = function() {
|
|||
var output = this.output;
|
||||
var outputEncodings = this.outputEncodings;
|
||||
var outputCallbacks = this.outputCallbacks;
|
||||
socket.cork();
|
||||
for (var i = 0; i < outputLength; i++) {
|
||||
ret = socket.write(output[i], outputEncodings[i],
|
||||
outputCallbacks[i]);
|
||||
}
|
||||
socket.uncork();
|
||||
|
||||
this.output = [];
|
||||
this.outputEncodings = [];
|
||||
|
|
Loading…
Reference in New Issue