From 35a3c6f88f5dac6c23bcc1a2c47fb87ad98e7d17 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sun, 3 May 2020 13:05:06 +0200 Subject: [PATCH] refactor: removed unecessary statement --- lib/client.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/client.js b/lib/client.js index 699da4f712f..6afe0ed40bc 100644 --- a/lib/client.js +++ b/lib/client.js @@ -50,20 +50,7 @@ function connect (client) { }) } -function destroyMaybe (client) { - if ( - client.closed && - !client._lastBody && - client[kQueue].length() === 0 && - client[kCallbacks].length === 0 - ) { - client.destroy() - } -} - function reconnect (client, err) { - err = err || new Error('premature close') - if (client._lastBody) { client._lastBody.destroy(err) client._lastBody = null @@ -430,6 +417,17 @@ function parseHeaders (headers) { module.exports = Client +function destroyMaybe (client) { + if ( + client.closed && + !client._lastBody && + client[kQueue].length() === 0 && + client[kCallbacks].length === 0 + ) { + client.destroy() + } +} + function destroySocket (socket, err, cb) { // This code is basically the same as... // stream.finished(socket, er => cb(err || er))