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

Commit

Permalink
Null references to request object on socket errors.
Browse files Browse the repository at this point in the history
Regarding #3199 and #3179 and issues seen in production.
Hopefully this fixes them.
  • Loading branch information
isaacs committed May 1, 2012
1 parent acf1950 commit bfe9cdb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/http.js
Expand Up @@ -1209,6 +1209,13 @@ ClientRequest.prototype.onSocket = function(socket) {
// fire on the request.
req.emit('error', createHangUpError());
}

// Nothing more to be done with this req, since the socket
// is closed, and we've emitted the appropriate abort/end/close/error
// events. Disavow all knowledge, and break the references to
// the variables trapped by closures and on the socket object.
req = null;
socket._httpMessage = null;
}
socket.on('close', closeListener);

Expand Down

0 comments on commit bfe9cdb

Please sign in to comment.