From 60b4f7c6f3802d9c20a74f107c9588156ce6e0b0 Mon Sep 17 00:00:00 2001 From: Gajus Kuizinas Date: Thu, 24 Oct 2019 12:52:18 +0100 Subject: [PATCH] fix: reset timeout after secureConnect --- package.json | 8 ++++---- src/classes/Agent.js | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cc8293ae..4f1c7609 100644 --- a/package.json +++ b/package.json @@ -20,10 +20,10 @@ }, "dependencies": { "boolean": "^2.0.2", - "core-js": "^3.3.2", + "core-js": "^3.3.3", "es6-error": "^4.1.1", "matcher": "^2.0.0", - "roarr": "^2.14.1", + "roarr": "^2.14.2", "semver": "^6.3.0", "serialize-error": "^5.0.0" }, @@ -43,7 +43,7 @@ "coveralls": "^3.0.7", "eslint": "^6.5.1", "eslint-config-canonical": "^17.7.0", - "flow-bin": "^0.109.0", + "flow-bin": "^0.110.1", "flow-copy-source": "^2.0.8", "get-port": "^5.0.0", "got": "^9.6.0", @@ -51,7 +51,7 @@ "nyc": "^14.1.1", "pem": "^1.14.3", "request": "^2.88.0", - "semantic-release": "^15.13.24", + "semantic-release": "^15.13.27", "sinon": "^7.5.0" }, "engines": { diff --git a/src/classes/Agent.js b/src/classes/Agent.js index 3bde25d2..e8f2b6be 100644 --- a/src/classes/Agent.js +++ b/src/classes/Agent.js @@ -124,6 +124,10 @@ class Agent { // $FlowFixMe It appears that Flow is missing the method description. this.createConnection(connectionConfiguration, (error, socket) => { + log.trace({ + target: connectionConfiguration, + }, 'connecting'); + // @see https://github.com/nodejs/node/issues/5757#issuecomment-305969057 if (socket) { socket.setTimeout(this.socketConnectionTimeout, () => { @@ -131,6 +135,18 @@ class Agent { }); socket.once('connect', () => { + log.trace({ + target: connectionConfiguration, + }, 'connected'); + + socket.setTimeout(0); + }); + + socket.once('secureConnect', () => { + log.trace({ + target: connectionConfiguration, + }, 'connected (secure)'); + socket.setTimeout(0); }); }