comparison src/event/ngx_event_quic.c @ 8055:924882f42dea quic

QUIC: do not artificially delay sending queued frames. This interacts badly with retransmissions of lost packets and can provoke spurious client retransmits.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 19 Aug 2020 13:24:54 +0300
parents 355e079c5eee
children f9b1a4e52597
comparison
equal deleted inserted replaced
8054:355e079c5eee 8055:924882f42dea
82 uint64_t largest_ack; /* received from peer */ 82 uint64_t largest_ack; /* received from peer */
83 uint64_t largest_pn; /* received from peer */ 83 uint64_t largest_pn; /* received from peer */
84 84
85 ngx_queue_t frames; 85 ngx_queue_t frames;
86 ngx_queue_t sent; 86 ngx_queue_t sent;
87
88 size_t frames_len;
89 } ngx_quic_send_ctx_t; 87 } ngx_quic_send_ctx_t;
90 88
91 89
92 struct ngx_quic_connection_s { 90 struct ngx_quic_connection_s {
93 ngx_str_t scid; 91 ngx_str_t scid;
3349 ngx_queue_insert_tail(&ctx->frames, &frame->queue); 3347 ngx_queue_insert_tail(&ctx->frames, &frame->queue);
3350 3348
3351 frame->len = ngx_quic_create_frame(NULL, frame); 3349 frame->len = ngx_quic_create_frame(NULL, frame);
3352 /* always succeeds */ 3350 /* always succeeds */
3353 3351
3354 ctx->frames_len += frame->len;
3355
3356 if (qc->closing) { 3352 if (qc->closing) {
3357 return; 3353 return;
3358 } 3354 }
3359 3355
3360 /* TODO: TCP_NODELAY analogue ? TCP_CORK and others... */ 3356 ngx_post_event(&qc->push, &ngx_posted_events);
3361
3362 if (ctx->frames_len < NGX_QUIC_MIN_DATA_NODELAY) {
3363 if (!qc->push.timer_set) {
3364 ngx_add_timer(&qc->push, qc->tp.max_ack_delay);
3365 }
3366
3367 } else {
3368 ngx_post_event(&qc->push, &ngx_posted_events);
3369 }
3370 } 3357 }
3371 3358
3372 3359
3373 static ngx_int_t 3360 static ngx_int_t
3374 ngx_quic_output(ngx_connection_t *c) 3361 ngx_quic_output(ngx_connection_t *c)
3461 3448
3462 f->first = ngx_current_msec; 3449 f->first = ngx_current_msec;
3463 3450
3464 ngx_queue_remove(&f->queue); 3451 ngx_queue_remove(&f->queue);
3465 ngx_queue_insert_tail(&range, &f->queue); 3452 ngx_queue_insert_tail(&range, &f->queue);
3466 ctx->frames_len -= f->len;
3467 3453
3468 len += f->len; 3454 len += f->len;
3469 3455
3470 } while (q != ngx_queue_sentinel(&ctx->frames)); 3456 } while (q != ngx_queue_sentinel(&ctx->frames));
3471 3457