@@ -651,7 +651,9 @@ Http2Session::Http2Session(Environment* env,
651
651
{
652
652
// Make the js_fields_ property accessible to JS land.
653
653
Local<ArrayBuffer> ab =
654
- ArrayBuffer::New(env->isolate(), js_fields_, kSessionUint8FieldCount);
654
+ ArrayBuffer::New(env->isolate(),
655
+ reinterpret_cast<uint8_t*>(&js_fields_),
656
+ kSessionUint8FieldCount);
655
657
Local<Uint8Array> uint8_arr =
656
658
Uint8Array::New(ab, 0, kSessionUint8FieldCount);
657
659
USE(wrap->Set(env->context(), env->fields_string(), uint8_arr));
@@ -1082,7 +1084,7 @@ int Http2Session::OnFrameNotSent(nghttp2_session* handle,
1082
1084
if (error_code == NGHTTP2_ERR_SESSION_CLOSING ||
1083
1085
error_code == NGHTTP2_ERR_STREAM_CLOSED ||
1084
1086
error_code == NGHTTP2_ERR_STREAM_CLOSING ||
1085
- session->js_fields_[kSessionFrameErrorListenerCount] == 0) {
1087
+ session->js_fields_.frame_error_listener_count == 0) {
1086
1088
return 0;
1087
1089
}
1088
1090
@@ -1388,7 +1390,7 @@ void Http2Session::HandleHeadersFrame(const nghttp2_frame* frame) {
1388
1390
// are considered advisory only, so this has no real effect other than to
1389
1391
// simply let user code know that the priority has changed.
1390
1392
void Http2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
1391
- if (js_fields_[kSessionPriorityListenerCount] == 0) return;
1393
+ if (js_fields_.priority_listener_count == 0) return;
1392
1394
Isolate* isolate = env()->isolate();
1393
1395
HandleScope scope(isolate);
1394
1396
Local<Context> context = env()->context();
@@ -1458,7 +1460,7 @@ void Http2Session::HandleGoawayFrame(const nghttp2_frame* frame) {
1458
1460
1459
1461
// Called by OnFrameReceived when a complete ALTSVC frame has been received.
1460
1462
void Http2Session::HandleAltSvcFrame(const nghttp2_frame* frame) {
1461
- if (!(js_fields_[kBitfield] & (1 << kSessionHasAltsvcListeners))) return;
1463
+ if (!(js_fields_.bitfield & (1 << kSessionHasAltsvcListeners))) return;
1462
1464
Isolate* isolate = env()->isolate();
1463
1465
HandleScope scope(isolate);
1464
1466
Local<Context> context = env()->context();
@@ -1537,7 +1539,7 @@ void Http2Session::HandlePingFrame(const nghttp2_frame* frame) {
1537
1539
return;
1538
1540
}
1539
1541
1540
- if (!(js_fields_[kBitfield] & (1 << kSessionHasPingListeners))) return;
1542
+ if (!(js_fields_.bitfield & (1 << kSessionHasPingListeners))) return;
1541
1543
// Notify the session that a ping occurred
1542
1544
arg = Buffer::Copy(env(),
1543
1545
reinterpret_cast<const char*>(frame->ping.opaque_data),
@@ -1549,8 +1551,8 @@ void Http2Session::HandlePingFrame(const nghttp2_frame* frame) {
1549
1551
void Http2Session::HandleSettingsFrame(const nghttp2_frame* frame) {
1550
1552
bool ack = frame->hd.flags & NGHTTP2_FLAG_ACK;
1551
1553
if (!ack) {
1552
- js_fields_[kBitfield] &= ~(1 << kSessionRemoteSettingsIsUpToDate);
1553
- if (!(js_fields_[kBitfield] & (1 << kSessionHasRemoteSettingsListeners)))
1554
+ js_fields_.bitfield &= ~(1 << kSessionRemoteSettingsIsUpToDate);
1555
+ if (!(js_fields_.bitfield & (1 << kSessionHasRemoteSettingsListeners)))
1554
1556
return;
1555
1557
// This is not a SETTINGS acknowledgement, notify and return
1556
1558
MakeCallback(env()->http2session_on_settings_function(), 0, nullptr);
0 commit comments