http: make OutgoingMessage._flush inline-able
This commit is contained in:
parent
da93d6adfb
commit
e3157972e1
@ -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…
x
Reference in New Issue
Block a user