diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 16d8b24c2979d4..fcd447bb5901fe 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; } diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 971dbb857f77f5..0cba1898fbaaad 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -230,7 +230,8 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) { if (where & SSL_CB_HANDSHAKE_START) { Local callback = object->Get(env->onhandshakestart_string()); if (callback->IsFunction()) { - c->MakeCallback(callback.As(), 0, nullptr); + Local argv[] = { env->GetNow() }; + c->MakeCallback(callback.As(), arraysize(argv), argv); } }