comparison src/event/quic/ngx_event_quic_output.c @ 8940:fb41e37ddeb0 quic

QUIC: decoupled path state and limitation status. The path validation status and anti-amplification limit status is actually two different variables. It is possible that validating path should not be limited (for example, when re-validating former path).
author Vladimir Homutov <vl@nginx.com>
date Mon, 13 Dec 2021 09:48:33 +0300
parents 501f28679d56
children 0433e69f5425
comparison
equal deleted inserted replaced
8939:ddd5e5c0f87d 8940:fb41e37ddeb0
158 p = dst; 158 p = dst;
159 159
160 len = ngx_min(qc->ctp.max_udp_payload_size, 160 len = ngx_min(qc->ctp.max_udp_payload_size,
161 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE); 161 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE);
162 162
163 if (path->state != NGX_QUIC_PATH_VALIDATED) { 163 if (path->limited) {
164 max = path->received * 3; 164 max = path->received * 3;
165 max = (path->sent >= max) ? 0 : max - path->sent; 165 max = (path->sent >= max) ? 0 : max - path->sent;
166 166
167 len = ngx_min(len, (size_t) max); 167 len = ngx_min(len, (size_t) max);
168 } 168 }
292 292
293 if (!qc->conf->gso_enabled) { 293 if (!qc->conf->gso_enabled) {
294 return 0; 294 return 0;
295 } 295 }
296 296
297 if (qsock->path->state != NGX_QUIC_PATH_VALIDATED) { 297 if (qsock->path->limited) {
298 /* don't even try to be faster on non-validated paths */ 298 /* don't even try to be faster on non-validated paths */
299 return 0; 299 return 0;
300 } 300 }
301 301
302 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_initial); 302 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_initial);
1227 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_application); 1227 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_application);
1228 1228
1229 ngx_quic_init_packet(c, ctx, qc->socket, &pkt); 1229 ngx_quic_init_packet(c, ctx, qc->socket, &pkt);
1230 1230
1231 /* account for anti-amplification limit: expand to allowed size */ 1231 /* account for anti-amplification limit: expand to allowed size */
1232 if (path->state != NGX_QUIC_PATH_VALIDATED) { 1232 if (path->limited) {
1233 max = path->received * 3; 1233 max = path->received * 3;
1234 max = (path->sent >= max) ? 0 : max - path->sent; 1234 max = (path->sent >= max) ? 0 : max - path->sent;
1235 if ((off_t) min > max) { 1235 if ((off_t) min > max) {
1236 min = max; 1236 min = max;
1237 } 1237 }