Simplified bitfield calculation of extension frame
This commit is contained in:
parent
9aee43f7d8
commit
827abb57e9
|
@ -70,6 +70,6 @@ void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option,
|
|||
}
|
||||
|
||||
option->opt_set_mask |= NGHTTP2_OPT_USER_RECV_EXT_TYPES;
|
||||
option->user_recv_ext_types[type / 8] = (uint8_t)(
|
||||
option->user_recv_ext_types[type / 8] | (1 << (7 - (type & 0x7))));
|
||||
option->user_recv_ext_types[type / 8] =
|
||||
(uint8_t)(option->user_recv_ext_types[type / 8] | (1 << (type & 0x7)));
|
||||
}
|
||||
|
|
|
@ -5345,7 +5345,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
|
|||
|
||||
if (!session->callbacks.unpack_extension_callback ||
|
||||
(session->user_recv_ext_types[iframe->frame.hd.type / 8] &
|
||||
(1 << (7 - (iframe->frame.hd.type & 0x7)))) == 0) {
|
||||
(1 << (iframe->frame.hd.type & 0x7))) == 0) {
|
||||
/* Silently ignore unknown frame type. */
|
||||
|
||||
busy = 1;
|
||||
|
|
|
@ -306,10 +306,11 @@ struct nghttp2_session {
|
|||
WINDOW_UPDATE is not queued. */
|
||||
uint8_t window_update_queued;
|
||||
/* Bitfield of extension frame types that application is willing to
|
||||
receive. First most significant 10 bits are standard frame types
|
||||
and not used. If bit is set, it indicates that incoming frame
|
||||
with that type is passed to user defined callbacks, otherwise
|
||||
they are ignored. */
|
||||
receive. To designate the bit of given frame type i, use
|
||||
user_recv_ext_types[i / 8] & (1 << (i & 0x7)). First 10 frame
|
||||
types are standard frame types and not used in this bitfield. If
|
||||
bit is set, it indicates that incoming frame with that type is
|
||||
passed to user defined callbacks, otherwise they are ignored. */
|
||||
uint8_t user_recv_ext_types[32];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue