Mercurial > hg > nginx-quic
comparison src/event/ngx_event_quic.c @ 8246:b9ac4752d0e6 quic
QUIC: send and process ack_delay for Initial and Handshake levels.
Previously, this only worked for Application level because before
quic-transport-30, there were the following constraints:
Because the receiver doesn't use the ACK Delay for Initial and Handshake
packets, a sender SHOULD send a value of 0.
When adjusting an RTT sample using peer-reported acknowledgement delays, an
endpoint ... MUST ignore the ACK Delay field of the ACK frame for packets
sent in the Initial and Handshake packet number space.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 10 Dec 2020 14:54:53 +0000 |
parents | 49efd27dace6 |
children | 1823e2152fc4 |
comparison
equal
deleted
inserted
replaced
8245:49efd27dace6 | 8246:b9ac4752d0e6 |
---|---|
3022 ngx_quic_frame_t *frame; | 3022 ngx_quic_frame_t *frame; |
3023 ngx_quic_connection_t *qc; | 3023 ngx_quic_connection_t *qc; |
3024 | 3024 |
3025 qc = ngx_quic_get_connection(c); | 3025 qc = ngx_quic_get_connection(c); |
3026 | 3026 |
3027 if (ctx->level == ssl_encryption_application) { | 3027 ack_delay = ngx_current_msec - ctx->largest_received; |
3028 ack_delay = ngx_current_msec - ctx->largest_received; | 3028 ack_delay *= 1000; |
3029 ack_delay *= 1000; | 3029 ack_delay >>= qc->ctp.ack_delay_exponent; |
3030 ack_delay >>= qc->ctp.ack_delay_exponent; | |
3031 | |
3032 } else { | |
3033 ack_delay = 0; | |
3034 } | |
3035 | 3030 |
3036 frame = ngx_quic_alloc_frame(c); | 3031 frame = ngx_quic_alloc_frame(c); |
3037 if (frame == NULL) { | 3032 if (frame == NULL) { |
3038 return NGX_ERROR; | 3033 return NGX_ERROR; |
3039 } | 3034 } |
3377 qc->rttvar = latest_rtt / 2; | 3372 qc->rttvar = latest_rtt / 2; |
3378 | 3373 |
3379 } else { | 3374 } else { |
3380 qc->min_rtt = ngx_min(qc->min_rtt, latest_rtt); | 3375 qc->min_rtt = ngx_min(qc->min_rtt, latest_rtt); |
3381 | 3376 |
3382 | 3377 ack_delay = ack->delay * (1 << qc->ctp.ack_delay_exponent) / 1000; |
3383 if (level == ssl_encryption_application) { | 3378 |
3384 ack_delay = ack->delay * (1 << qc->ctp.ack_delay_exponent) / 1000; | 3379 if (c->ssl->handshaked) { |
3385 ack_delay = ngx_min(ack_delay, qc->ctp.max_ack_delay); | 3380 ack_delay = ngx_min(ack_delay, qc->ctp.max_ack_delay); |
3386 | |
3387 } else { | |
3388 ack_delay = 0; | |
3389 } | 3381 } |
3390 | 3382 |
3391 adjusted_rtt = latest_rtt; | 3383 adjusted_rtt = latest_rtt; |
3392 | 3384 |
3393 if (qc->min_rtt + ack_delay < latest_rtt) { | 3385 if (qc->min_rtt + ack_delay < latest_rtt) { |