comparison src/event/quic/ngx_event_quic_migration.c @ 9096:c6db94ec3841 quic

QUIC: separated path validation retransmit backoff. Path validation packets containing PATH_CHALLENGE frames are sent separately from regular frame queue, because of the need to use a decicated path and pad the packets. The packets are sent periodically, separately from the regular probe/lost detection mechanism. A path validation packet is resent up to 3 times, each time after PTO expiration, with increasing per-path PTO backoff.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 09 May 2023 19:42:39 +0400
parents 28fc35b71d75
children a9fef6ca45a8
comparison
equal deleted inserted replaced
9095:52cddd44ec11 9096:c6db94ec3841
494 494
495 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 495 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
496 "quic initiated validation of path seq:%uL", path->seqnum); 496 "quic initiated validation of path seq:%uL", path->seqnum);
497 497
498 path->validating = 1; 498 path->validating = 1;
499 path->tries = 0;
499 500
500 if (RAND_bytes(path->challenge1, 8) != 1) { 501 if (RAND_bytes(path->challenge1, 8) != 1) {
501 return NGX_ERROR; 502 return NGX_ERROR;
502 } 503 }
503 504
511 512
512 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_application); 513 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_application);
513 pto = ngx_quic_pto(c, ctx); 514 pto = ngx_quic_pto(c, ctx);
514 515
515 path->expires = ngx_current_msec + pto; 516 path->expires = ngx_current_msec + pto;
516 path->tries = NGX_QUIC_PATH_RETRIES;
517 517
518 if (!qc->path_validation.timer_set) { 518 if (!qc->path_validation.timer_set) {
519 ngx_add_timer(&qc->path_validation, pto); 519 ngx_add_timer(&qc->path_validation, pto);
520 } 520 }
521 521
576 576
577 c = ev->data; 577 c = ev->data;
578 qc = ngx_quic_get_connection(c); 578 qc = ngx_quic_get_connection(c);
579 579
580 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_application); 580 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_application);
581 pto = ngx_quic_pto(c, ctx);
582 581
583 next = -1; 582 next = -1;
584 now = ngx_current_msec; 583 now = ngx_current_msec;
585 584
586 q = ngx_queue_head(&qc->paths); 585 q = ngx_queue_head(&qc->paths);
603 } 602 }
604 603
605 continue; 604 continue;
606 } 605 }
607 606
608 if (--path->tries) { 607 if (++path->tries < NGX_QUIC_PATH_RETRIES) {
608 pto = ngx_quic_pto(c, ctx) << path->tries;
609
609 path->expires = ngx_current_msec + pto; 610 path->expires = ngx_current_msec + pto;
610 611
611 if (next == -1 || pto < next) { 612 if (next == -1 || pto < next) {
612 next = pto; 613 next = pto;
613 } 614 }