aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/http.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/http.js b/lib/http.js
index 98a9ab9c87..8cc37ed47c 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -1289,8 +1289,10 @@ Agent.prototype._establishNewConnection = function() {
// All that should be required for keep-alive is to not reconnect,
// but outgoingFlush instead.
if (!req.shouldKeepAlive) {
- debug('AGENT socket.end()');
- if (socket.writable) socket.end();
+ if (socket.writable) {
+ debug('AGENT socket.destroySoon()');
+ socket.destroySoon();
+ }
assert(!socket.writable);
} else {
debug('AGENT socket keep-alive');