Skip to content

Commit

Permalink
refactor: move helper to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed May 3, 2020
1 parent fcd600a commit 5bd60c2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ function connect (client) {
})
}

function destroyMaybe (client) {
if (
client.closed &&
!client[kLastBody] &&
client[kQueue].length() === 0 &&
client[kInflight].length === 0
) {
client.destroy()
}
}

function reconnect (client, err) {
err = err || new Error('other side closed')

Expand Down Expand Up @@ -437,6 +426,17 @@ function parseHeaders (headers) {

module.exports = Client

function destroyMaybe (client) {
if (
client.closed &&
!client[kLastBody] &&
client[kQueue].length() === 0 &&
client[kInflight].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 5bd60c2

Please sign in to comment.