summaryrefslogtreecommitdiff
path: root/lib/http.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/http.js')
-rw-r--r--lib/http.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/http.js b/lib/http.js
index af36d5f01..b61be6538 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -1325,7 +1325,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);