comparison src/event/ngx_event_quic.c @ 8147:018baa412c0d quic

try: --skiptests
author Vladimir Homutov <vl@nginx.com>
date Mon, 19 Oct 2020 10:10:21 +0300
parents 61f1c6ac8967
children 93be5658a250
comparison
equal deleted inserted replaced
8146:61f1c6ac8967 8147:018baa412c0d
241 ngx_quic_header_t *pkt); 241 ngx_quic_header_t *pkt);
242 static ngx_int_t ngx_quic_ack_packet(ngx_connection_t *c, 242 static ngx_int_t ngx_quic_ack_packet(ngx_connection_t *c,
243 ngx_quic_header_t *pkt); 243 ngx_quic_header_t *pkt);
244 static ngx_int_t ngx_quic_send_ack_range(ngx_connection_t *c, 244 static ngx_int_t ngx_quic_send_ack_range(ngx_connection_t *c,
245 ngx_quic_send_ctx_t *ctx, uint64_t smallest, uint64_t largest); 245 ngx_quic_send_ctx_t *ctx, uint64_t smallest, uint64_t largest);
246 static void ngx_quic_drop_ack_ranges(ngx_connection_t *c,
247 ngx_quic_send_ctx_t *ctx, uint64_t pn);
246 static ngx_int_t ngx_quic_send_ack(ngx_connection_t *c, 248 static ngx_int_t ngx_quic_send_ack(ngx_connection_t *c,
247 ngx_quic_send_ctx_t *ctx); 249 ngx_quic_send_ctx_t *ctx);
248 static ngx_int_t ngx_quic_ack_delay(ngx_connection_t *c, 250 static ngx_int_t ngx_quic_ack_delay(ngx_connection_t *c,
249 struct timeval *received, enum ssl_encryption_level_t level); 251 struct timeval *received, enum ssl_encryption_level_t level);
250 static ngx_int_t ngx_quic_send_cc(ngx_connection_t *c); 252 static ngx_int_t ngx_quic_send_cc(ngx_connection_t *c);
2507 2509
2508 return NGX_OK; 2510 return NGX_OK;
2509 } 2511 }
2510 2512
2511 2513
2514 static void
2515 ngx_quic_drop_ack_ranges(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
2516 uint64_t pn)
2517 {
2518 uint64_t base;
2519 ngx_uint_t i, smallest, largest;
2520 ngx_quic_ack_range_t *r;
2521
2522 base = ctx->largest_range;
2523
2524 if (base == (uint64_t) -1) {
2525 return;
2526 }
2527
2528 largest = base;
2529 smallest = largest - ctx->first_range;
2530
2531 if (pn >= largest) {
2532 ctx->largest_range = (uint64_t) - 1;
2533 ctx->first_range = 0;
2534 ctx->nranges = 0;
2535 return;
2536 }
2537
2538 if (pn >= smallest) {
2539 ctx->first_range = largest - pn - 1;
2540 ctx->nranges = 0;
2541 return;
2542 }
2543
2544 for (i = 0; i < ctx->nranges; i++) {
2545 r = &ctx->ranges[i];
2546 largest = smallest - r->gap - 2;
2547 smallest = largest - r->range;
2548 if (pn >= largest) {
2549 ctx->nranges = i;
2550 return;
2551 }
2552 if (pn >= smallest) {
2553 r->range = largest - pn - 1;
2554 ctx->nranges = i + 1;
2555 return;
2556 }
2557 }
2558 }
2559
2560
2512 static ngx_int_t 2561 static ngx_int_t
2513 ngx_quic_send_ack(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx) 2562 ngx_quic_send_ack(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx)
2514 { 2563 {
2515 size_t ranges_len; 2564 size_t ranges_len;
2516 ngx_quic_frame_t *frame; 2565 ngx_quic_frame_t *frame;
2777 q = ngx_queue_prev(q); 2826 q = ngx_queue_prev(q);
2778 2827
2779 if (f->pnum >= min && f->pnum <= max) { 2828 if (f->pnum >= min && f->pnum <= max) {
2780 ngx_quic_congestion_ack(c, f); 2829 ngx_quic_congestion_ack(c, f);
2781 2830
2782 ngx_quic_handle_stream_ack(c, f); 2831 switch (f->type) {
2832 case NGX_QUIC_FT_ACK:
2833 ngx_quic_drop_ack_ranges(c, ctx, f->u.ack.largest);
2834 break;
2835
2836 case NGX_QUIC_FT_STREAM0:
2837 case NGX_QUIC_FT_STREAM1:
2838 case NGX_QUIC_FT_STREAM2:
2839 case NGX_QUIC_FT_STREAM3:
2840 case NGX_QUIC_FT_STREAM4:
2841 case NGX_QUIC_FT_STREAM5:
2842 case NGX_QUIC_FT_STREAM6:
2843 case NGX_QUIC_FT_STREAM7:
2844 ngx_quic_handle_stream_ack(c, f);
2845 break;
2846 }
2783 2847
2784 if (f->pnum > found_num || !found) { 2848 if (f->pnum > found_num || !found) {
2785 *send_time = f->last; 2849 *send_time = f->last;
2786 found_num = f->pnum; 2850 found_num = f->pnum;
2787 } 2851 }
2898 { 2962 {
2899 uint64_t sent, unacked; 2963 uint64_t sent, unacked;
2900 ngx_event_t *wev; 2964 ngx_event_t *wev;
2901 ngx_quic_stream_t *sn; 2965 ngx_quic_stream_t *sn;
2902 ngx_quic_connection_t *qc; 2966 ngx_quic_connection_t *qc;
2903
2904 if (f->type < NGX_QUIC_FT_STREAM0 || f->type > NGX_QUIC_FT_STREAM7) {
2905 return;
2906 }
2907 2967
2908 qc = c->quic; 2968 qc = c->quic;
2909 2969
2910 sn = ngx_quic_find_stream(&qc->streams.tree, f->u.stream.stream_id); 2970 sn = ngx_quic_find_stream(&qc->streams.tree, f->u.stream.stream_id);
2911 if (sn == NULL) { 2971 if (sn == NULL) {