Mercurial > hg > nginx
diff src/event/quic/ngx_event_quic_transport.c @ 8692:0697294f79a4 quic
QUIC: removed redundant "app" flag from ngx_quic_close_frame_t.
The flag was introduced to create type-aware CONNECTION_CLOSE frames,
and now is replaced with frame type information, directly accessible.
Notably, this fixes type logging for received frames in b3d9e57d0f62.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 03 Feb 2021 12:39:41 +0300 |
parents | 3443ee341cc1 |
children | 9ed95726b99b |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_transport.c +++ b/src/event/quic/ngx_event_quic_transport.c @@ -116,7 +116,7 @@ static size_t ngx_quic_create_new_connec ngx_quic_new_conn_id_frame_t *rcid); static size_t ngx_quic_create_retire_connection_id(u_char *p, ngx_quic_retire_cid_frame_t *rcid); -static size_t ngx_quic_create_close(u_char *p, ngx_quic_close_frame_t *cl); +static size_t ngx_quic_create_close(u_char *p, ngx_quic_frame_t *f); static ngx_int_t ngx_quic_parse_transport_param(u_char *p, u_char *end, uint16_t id, ngx_quic_tp_t *dst); @@ -1249,7 +1249,7 @@ ngx_quic_create_frame(u_char *p, ngx_qui case NGX_QUIC_FT_CONNECTION_CLOSE: case NGX_QUIC_FT_CONNECTION_CLOSE_APP: f->need_ack = 0; - return ngx_quic_create_close(p, &f->u.close); + return ngx_quic_create_close(p, f); case NGX_QUIC_FT_MAX_STREAMS: return ngx_quic_create_max_streams(p, &f->u.max_streams); @@ -1956,20 +1956,19 @@ ngx_quic_create_transport_params(u_char static size_t -ngx_quic_create_close(u_char *p, ngx_quic_close_frame_t *cl) +ngx_quic_create_close(u_char *p, ngx_quic_frame_t *f) { - size_t len; - u_char *start; - ngx_uint_t type; - - type = cl->app ? NGX_QUIC_FT_CONNECTION_CLOSE_APP - : NGX_QUIC_FT_CONNECTION_CLOSE; + size_t len; + u_char *start; + ngx_quic_close_frame_t *cl; + + cl = &f->u.close; if (p == NULL) { - len = ngx_quic_varint_len(type); + len = ngx_quic_varint_len(f->type); len += ngx_quic_varint_len(cl->error_code); - if (!cl->app) { + if (f->type != NGX_QUIC_FT_CONNECTION_CLOSE_APP) { len += ngx_quic_varint_len(cl->frame_type); } @@ -1981,10 +1980,10 @@ ngx_quic_create_close(u_char *p, ngx_qui start = p; - ngx_quic_build_int(&p, type); + ngx_quic_build_int(&p, f->type); ngx_quic_build_int(&p, cl->error_code); - if (!cl->app) { + if (f->type != NGX_QUIC_FT_CONNECTION_CLOSE_APP) { ngx_quic_build_int(&p, cl->frame_type); }