Browse Source

http: make OutgoingMessage._flush inline-able

v0.11.6-release
isaacs 12 years ago
parent
commit
e3157972e1
  1. 11
      lib/_http_outgoing.js

11
lib/_http_outgoing.js

@ -525,7 +525,6 @@ OutgoingMessage.prototype._finish = function() {
};
OutgoingMessage.prototype._flush = function() {
// This logic is probably a bit confusing. Let me explain a bit:
//
// In both HTTP servers and clients it is possible to queue up several
@ -545,18 +544,13 @@ OutgoingMessage.prototype._flush = function() {
//
// This function, outgoingFlush(), is called by both the Server and Client
// to attempt to flush any pending messages out to the socket.
if (!this.socket) return;
OutgoingMessage.prototype._flush = function() {
if (this.socket && this.socket.writable) {
var ret;
while (this.output.length) {
if (!this.socket.writable) return; // XXX Necessary?
var data = this.output.shift();
var encoding = this.outputEncodings.shift();
var cb = this.outputCallbacks.shift();
ret = this.socket.write(data, encoding, cb);
}
@ -567,4 +561,5 @@ OutgoingMessage.prototype._flush = function() {
// This is necessary to prevent https from breaking
this.emit('drain');
}
}
};

Loading…
Cancel
Save