http: delay ret declaration in method _flushOutput

PR-URL: https://github.com/nodejs/node/pull/26562
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
gengjiawen 2019-03-10 13:00:07 +08:00 committed by Daniel Bevenius
parent cd8b7391dc
commit 2788fd6b98

View File

@ -791,13 +791,13 @@ OutgoingMessage.prototype._flush = function _flush() {
};
OutgoingMessage.prototype._flushOutput = function _flushOutput(socket) {
var ret;
var outputLength = this.outputData.length;
const outputLength = this.outputData.length;
if (outputLength <= 0)
return ret;
return undefined;
var outputData = this.outputData;
const outputData = this.outputData;
socket.cork();
let ret;
for (var i = 0; i < outputLength; i++) {
const { data, encoding, callback } = outputData[i];
ret = socket.write(data, encoding, callback);