From 92ba624fa1da61c4061aa554877bfa3c94c83324 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sun, 4 Feb 2018 11:51:18 -0500 Subject: tls: provide now value from C++ Instead of separately calling into C++ from JS to retrieve the Timer.now() value, pass it in as an argument. PR-URL: https://github.com/nodejs/node/pull/18562 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- lib/_tls_wrap.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/_tls_wrap.js') diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 16d8b24c29..fcd447bb59 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -32,7 +32,6 @@ const common = require('_tls_common'); const { StreamWrap } = require('_stream_wrap'); const { Buffer } = require('buffer'); const debug = util.debuglog('tls'); -const { Timer } = process.binding('timer_wrap'); const tls_wrap = process.binding('tls_wrap'); const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); @@ -49,14 +48,13 @@ const kSNICallback = Symbol('snicallback'); const noop = () => {}; -function onhandshakestart() { +function onhandshakestart(now) { debug('onhandshakestart'); - const owner = this.owner; - const now = Timer.now(); - assert(now >= this.lastHandshakeTime); + const owner = this.owner; + if ((now - this.lastHandshakeTime) >= tls.CLIENT_RENEG_WINDOW * 1000) { this.handshakes = 0; } -- cgit v1.2.3