mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
http2: track async state for sending
Sending pending data may involve running arbitrary JavaScript code. Therefore, it should involve a callback scope. PR-URL: https://github.com/nodejs/node/pull/16461 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
1 parent
e578268ef9
commit
56dd734a6a
1 file changed
+6
@@ -91,6 +91,12 @@ Http2Session::Http2Session(Environment* env,
|
||||
prep_->data = static_cast<void*>(this);
|
||||
uv_prepare_start(prep_, [](uv_prepare_t* t) {
|
||||
Http2Session* session = static_cast<Http2Session*>(t->data);
|
||||
HandleScope scope(session->env()->isolate());
|
||||
Context::Scope context_scope(session->env()->context());
|
||||
|
||||
// Sending data may call arbitrary JS code, so keep track of
|
||||
// async context.
|
||||
InternalCallbackScope callback_scope(session);
|
||||
session->SendPendingData();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user