summaryrefslogtreecommitdiff
path: root/lib/_tls_wrap.js
diff options
context:
space:
mode:
authorLuigi Pinca <luigipinca@gmail.com>2019-01-15 16:12:12 +0100
committerLuigi Pinca <luigipinca@gmail.com>2019-01-20 14:56:35 +0100
commitaaa7547e7779520428a2e48b728a5993b00c330a (patch)
tree24015b90d6f21eb67eff9c7952022c79c3878c17 /lib/_tls_wrap.js
parentcc26957cc30d89619d3b9be85f5301111e17615a (diff)
downloadandroid-node-v8-aaa7547e7779520428a2e48b728a5993b00c330a.tar.gz
android-node-v8-aaa7547e7779520428a2e48b728a5993b00c330a.tar.bz2
android-node-v8-aaa7547e7779520428a2e48b728a5993b00c330a.zip
tls: make tls.connect() accept a timeout option
If specified, and only when a socket is created internally, the option will make `socket.setTimeout()` to be called on the created socket with the given timeout. This is consistent with the `timeout` option of `net.connect()` and prevents the `timeout` option of the `https.Agent` from being ignored when a socket is created. PR-URL: https://github.com/nodejs/node/pull/25517 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r--lib/_tls_wrap.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index a72091b22e..ef2e5e3a7b 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -1256,6 +1256,11 @@ exports.connect = function connect(...args) {
localAddress: options.localAddress,
lookup: options.lookup
};
+
+ if (options.timeout) {
+ tlssock.setTimeout(options.timeout);
+ }
+
tlssock.connect(connectOpt, tlssock._start);
}