-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tls: pass in Timer.now() value straight from C++ #18562
Conversation
src/env.cc
Outdated
return Integer::New(this->isolate(), static_cast<uint32_t>(now)); | ||
else | ||
return Number::New(this->isolate(), static_cast<double>(now)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The this->
prefixes aren't necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Total brain fart there, haha.
src/tls_wrap.cc
Outdated
@@ -230,7 +230,8 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) { | |||
if (where & SSL_CB_HANDSHAKE_START) { | |||
Local<Value> callback = object->Get(env->onhandshakestart_string()); | |||
if (callback->IsFunction()) { | |||
c->MakeCallback(callback.As<Function>(), 0, nullptr); | |||
Local<Value> argv[] = { env->GetNow() }; | |||
c->MakeCallback(callback.As<Function>(), 1, argv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use arraysize(argv)
?
Instead of separately calling into C++ from JS to retrieve the Timer.now() value, pass it in as an argument.
e03b5fd
to
f24c570
Compare
src/env.cc
Outdated
uint64_t now = uv_now(event_loop()); | ||
CHECK(now >= timer_base()); | ||
now -= timer_base(); | ||
if (now <= 0xfffffff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could go until at least 0x7fffffff
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that might actually be missing an extra f
? I think it's supposed to be 2**32 - 1
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apapirovski If you want that then yes, one more f
than in the current code it is (0xffffffff
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looks like that's been incorrect since it got first committed like 3-4 years ago :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! :)
src/env.cc
Outdated
Local<Value> Environment::GetNow() { | ||
uv_update_time(event_loop()); | ||
uint64_t now = uv_now(event_loop()); | ||
CHECK(now >= timer_base()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHECK_GE
(Sorry, probably forgot to mention that last time.)
Lite CI: https://ci.nodejs.org/job/node-test-pull-request-lite/158/ (small change) |
PR-URL: #18562 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Instead of separately calling into C++ from JS to retrieve the Timer.now() value, pass it in as an argument. PR-URL: #18562 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Should this be backported to |
PR-URL: nodejs#18562 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Instead of separately calling into C++ from JS to retrieve the Timer.now() value, pass it in as an argument. PR-URL: nodejs#18562 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Should this be backported to |
Instead of separately calling into C++ from JS to retrieve the
Timer.now()
value, pass it in as an argument.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
tls, src