From 0e4595b196b6c4d6126e1432316cec57f3d7a24b Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Sat, 8 May 2021 17:09:18 +0800 Subject: [PATCH] http: refactor to remove redundant argument of _deferToConnect --- lib/_http_client.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 4184191c0fbabc..49ed492b3d16b4 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -817,8 +817,8 @@ function onSocketNT(req, socket, err) { } } -ClientRequest.prototype._deferToConnect = _deferToConnect; -function _deferToConnect(method, arguments_, cb) { +ClientRequest.prototype._deferToConnect = +function _deferToConnect(method, arguments_) { // This function is for calls that need to happen once the socket is // assigned to this request and writable. It's an important promisy // thing for all the socket calls that happen either now @@ -828,9 +828,6 @@ function _deferToConnect(method, arguments_, cb) { const callSocketMethod = () => { if (method) ReflectApply(this.socket[method], this.socket, arguments_); - - if (typeof cb === 'function') - cb(); }; const onSocket = () => { @@ -846,7 +843,7 @@ function _deferToConnect(method, arguments_, cb) { } else { onSocket(); } -} +}; ClientRequest.prototype.setTimeout = function setTimeout(msecs, callback) { if (this._ended) {