Skip to content

Commit

Permalink
refactor: removed unecessary statement
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed May 3, 2020
1 parent c60c6d8 commit 35a3c6f
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 35a3c6f

Please sign in to comment.