From d7ab1bfb7c21aa51ba9ab48b251460291c6be679 Mon Sep 17 00:00:00 2001 From: Vladimir Homutov Date: Mon, 13 Jul 2020 10:07:20 +0300 Subject: [PATCH] QUIC: caching c->quic in the ngx_quic_handle_ack_frame() function. To minimize difference with the following changes. --- src/event/ngx_event_quic.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c index 62598d341..5b9593e58 100644 --- a/src/event/ngx_event_quic.c +++ b/src/event/ngx_event_quic.c @@ -2248,14 +2248,17 @@ static ngx_int_t ngx_quic_handle_ack_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, ngx_quic_ack_frame_t *ack) { - ssize_t n; - u_char *pos, *end; - uint64_t gap, range; - ngx_msec_t send_time; - ngx_uint_t i, min, max; - ngx_quic_send_ctx_t *ctx; + ssize_t n; + u_char *pos, *end; + uint64_t gap, range; + ngx_msec_t send_time; + ngx_uint_t i, min, max; + ngx_quic_send_ctx_t *ctx; + ngx_quic_connection_t *qc; - ctx = ngx_quic_get_send_ctx(c->quic, pkt->level); + qc = c->quic; + + ctx = ngx_quic_get_send_ctx(qc, pkt->level); ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic ngx_quic_handle_ack_frame level %d", pkt->level); @@ -2267,7 +2270,7 @@ ngx_quic_handle_ack_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, */ if (ack->first_range > ack->largest) { - c->quic->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; + qc->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; ngx_log_error(NGX_LOG_INFO, c->log, 0, "quic invalid first range in ack frame"); return NGX_ERROR; @@ -2313,7 +2316,7 @@ ngx_quic_handle_ack_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, pos += n; if (gap >= min) { - c->quic->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; + qc->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; ngx_log_error(NGX_LOG_INFO, c->log, 0, "quic invalid range %ui in ack frame", i); return NGX_ERROR; @@ -2322,7 +2325,7 @@ ngx_quic_handle_ack_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, max = min - 1 - gap; if (range > max + 1) { - c->quic->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; + qc->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; ngx_log_error(NGX_LOG_INFO, c->log, 0, "quic invalid range %ui in ack frame", i); return NGX_ERROR;