Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

http: Optimize queued client aborts #7533

Closed
wants to merge 2 commits into from
Closed
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
Prev Previous commit
http: Use Date.now for client aborted flag
Adds truthy flag that can be used for debugging as well. Per review by @tjfontaine.
  • Loading branch information
kpdecker committed May 22, 2014
commit 3b69889c87a083ff4e9ad1cd6da17d703c430d81
6 changes: 4 additions & 2 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ util.inherits(ClientRequest, OutgoingMessage);

exports.ClientRequest = ClientRequest;

ClientRequest.prototype.aborted = false;
ClientRequest.prototype.aborted = undefined;

ClientRequest.prototype._finish = function() {
DTRACE_HTTP_CLIENT_REQUEST(this, this.connection);
Expand All @@ -189,7 +189,9 @@ ClientRequest.prototype._implicitHeader = function() {

ClientRequest.prototype.abort = function() {
// Mark as aborting so we can avoid sending queued request data
this.aborted = true;
// This is used as a truthy flag elsewhere. The use of Date.now is for debugging
// purposes only.
this.aborted = Date.now();

// If we're aborting, we don't care about any more response data.
if (this.res)
Expand Down