Fixes #1085. The agent end event may call detachSocket() after the socket is detached and destroyed by abort(). This patch avoids that behavior.

This commit is contained in:
Stefan Rusu 2011-07-14 15:33:04 +03:00 committed by koichik
parent 901ebed8ff
commit 5b02d564c3

View File

@ -1333,7 +1333,10 @@ Agent.prototype._establishNewConnection = function() {
debug('AGENT socket keep-alive');
}
req.detachSocket(socket);
// The socket may already be detached and destroyed by an abort call
if (socket._httpMessage) {
req.detachSocket(socket);
}
assert(!socket._httpMessage);