Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-03-29 20:38:24 +0300
committerAnna Henningsen <anna@addaleax.net>2020-04-02 19:15:38 +0300
commit0be9ebb7220d3fe72e4274613d988d91dae717f2 (patch)
tree70e2b1747140a2a8f80d4f26e0a51d71c71dba91 /src/node_http2.cc
parent5f5d3805f03f267ef47f55ffcb868cff58d0370a (diff)
src: minor http2 refactorings
* Simplify Http2Priority struct * BooleanValue => IsTrue/IsFalse Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/32551 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node_http2.cc')
-rw-r--r--src/node_http2.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc
index 168817b236f..cd3b989a57e 100644
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -348,11 +348,11 @@ Http2Priority::Http2Priority(Environment* env,
Local<Context> context = env->context();
int32_t parent_ = parent->Int32Value(context).ToChecked();
int32_t weight_ = weight->Int32Value(context).ToChecked();
- bool exclusive_ = exclusive->BooleanValue(env->isolate());
+ bool exclusive_ = exclusive->IsTrue();
Debug(env, DebugCategory::HTTP2STREAM,
"Http2Priority: parent: %d, weight: %d, exclusive: %s\n",
parent_, weight_, exclusive_ ? "yes" : "no");
- nghttp2_priority_spec_init(&spec, parent_, weight_, exclusive_ ? 1 : 0);
+ nghttp2_priority_spec_init(this, parent_, weight_, exclusive_ ? 1 : 0);
}
@@ -996,8 +996,7 @@ int Http2Session::OnStreamClose(nghttp2_session* handle,
MaybeLocal<Value> answer =
stream->MakeCallback(env->http2session_on_stream_close_function(),
1, &arg);
- if (answer.IsEmpty() ||
- !(answer.ToLocalChecked()->BooleanValue(env->isolate()))) {
+ if (answer.IsEmpty() || answer.ToLocalChecked()->IsFalse()) {
// Skip to destroy
stream->Destroy();
}
@@ -2444,9 +2443,7 @@ void Http2Session::Destroy(const FunctionCallbackInfo<Value>& args) {
Local<Context> context = env->context();
uint32_t code = args[0]->Uint32Value(context).ToChecked();
- bool socketDestroyed = args[1]->BooleanValue(env->isolate());
-
- session->Close(code, socketDestroyed);
+ session->Close(code, args[1]->IsTrue());
}
// Submits a new request on the Http2Session and returns either an error code
@@ -2465,7 +2462,7 @@ void Http2Session::Request(const FunctionCallbackInfo<Value>& args) {
int32_t ret = 0;
Http2Stream* stream =
session->Http2Session::SubmitRequest(
- *priority,
+ &priority,
Http2Headers(env, headers),
&ret,
static_cast<int>(options));
@@ -2638,9 +2635,9 @@ void Http2Stream::Priority(const FunctionCallbackInfo<Value>& args) {
ASSIGN_OR_RETURN_UNWRAP(&stream, args.Holder());
Http2Priority priority(env, args[0], args[1], args[2]);
- bool silent = args[3]->BooleanValue(env->isolate());
+ bool silent = args[3]->IsTrue();
- CHECK_EQ(stream->SubmitPriority(*priority, silent), 0);
+ CHECK_EQ(stream->SubmitPriority(&priority, silent), 0);
Debug(stream, "priority submitted");
}