Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Prevent FIN_WAIT connections by using stream.destorySoon() #524

Merged
merged 2 commits into from
Jul 24, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,13 @@ Client.prototype.close = function(callback, reason) {
// needed in case of errors
if (!that._closed) {
cleanup();
that.connection.stream.end();
// prefer destroySoon() as it prevents FIN_WAIT connections
if (that.connection.stream.destroySoon) {
that.connection.stream.destroySoon();
}
else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please move the else inline with the }?

that.connection.stream.end();
}
}
});
};
Expand Down