mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
QUIC: packet based bytes_in_flight accounting.
A packet size is kept in one of the frames belonging to the packet.
This commit is contained in:
parent
81e9a5d77c
commit
6e17937db4
@ -288,7 +288,8 @@ static void ngx_quic_free_frame(ngx_connection_t *c, ngx_quic_frame_t *frame);
|
|||||||
|
|
||||||
static void ngx_quic_congestion_ack(ngx_connection_t *c,
|
static void ngx_quic_congestion_ack(ngx_connection_t *c,
|
||||||
ngx_quic_frame_t *frame);
|
ngx_quic_frame_t *frame);
|
||||||
static void ngx_quic_congestion_lost(ngx_connection_t *c, ngx_msec_t sent);
|
static void ngx_quic_congestion_lost(ngx_connection_t *c,
|
||||||
|
ngx_quic_frame_t *frame);
|
||||||
|
|
||||||
|
|
||||||
static SSL_QUIC_METHOD quic_method = {
|
static SSL_QUIC_METHOD quic_method = {
|
||||||
@ -3627,9 +3628,11 @@ ngx_quic_send_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
|
|||||||
ngx_del_timer(&qc->pto);
|
ngx_del_timer(&qc->pto);
|
||||||
}
|
}
|
||||||
ngx_add_timer(&qc->pto, ngx_quic_pto(c, ctx));
|
ngx_add_timer(&qc->pto, ngx_quic_pto(c, ctx));
|
||||||
|
|
||||||
|
start->plen = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
qc->congestion.in_flight += out.len;
|
qc->congestion.in_flight += len;
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
"quic congestion send if:%uz",
|
"quic congestion send if:%uz",
|
||||||
@ -3783,12 +3786,11 @@ ngx_quic_detect_lost(ngx_connection_t *c, ngx_uint_t ack)
|
|||||||
q = ngx_queue_next(q);
|
q = ngx_queue_next(q);
|
||||||
|
|
||||||
ngx_queue_remove(&f->queue);
|
ngx_queue_remove(&f->queue);
|
||||||
qc->congestion.in_flight -= f->len;
|
|
||||||
ngx_queue_insert_tail(&range, &f->queue);
|
ngx_queue_insert_tail(&range, &f->queue);
|
||||||
|
|
||||||
} while (q != ngx_queue_sentinel(&ctx->sent));
|
} while (q != ngx_queue_sentinel(&ctx->sent));
|
||||||
|
|
||||||
ngx_quic_congestion_lost(c, start->last);
|
ngx_quic_congestion_lost(c, start);
|
||||||
|
|
||||||
if (ngx_quic_send_frames(c, ctx, &range) != NGX_OK) {
|
if (ngx_quic_send_frames(c, ctx, &range) != NGX_OK) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
@ -4535,26 +4537,34 @@ ngx_quic_congestion_ack(ngx_connection_t *c, ngx_quic_frame_t *f)
|
|||||||
ngx_quic_congestion_t *cg;
|
ngx_quic_congestion_t *cg;
|
||||||
ngx_quic_connection_t *qc;
|
ngx_quic_connection_t *qc;
|
||||||
|
|
||||||
|
if (f->plen == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
qc = c->quic;
|
qc = c->quic;
|
||||||
cg = &qc->congestion;
|
cg = &qc->congestion;
|
||||||
|
|
||||||
cg->in_flight -= f->len;
|
cg->in_flight -= f->plen;
|
||||||
|
|
||||||
timer = f->last - cg->recovery_start;
|
timer = f->last - cg->recovery_start;
|
||||||
|
|
||||||
if ((ngx_msec_int_t) timer <= 0) {
|
if ((ngx_msec_int_t) timer <= 0) {
|
||||||
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
|
"quic congestion ack recovery win:%uz, ss:%uz, if:%uz",
|
||||||
|
cg->window, cg->ssthresh, cg->in_flight);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cg->window < cg->ssthresh) {
|
if (cg->window < cg->ssthresh) {
|
||||||
cg->window += f->len;
|
cg->window += f->plen;
|
||||||
|
|
||||||
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
"quic congestion slow start win:%uz, ss:%uz, if:%uz",
|
"quic congestion slow start win:%uz, ss:%uz, if:%uz",
|
||||||
cg->window, cg->ssthresh, cg->in_flight);
|
cg->window, cg->ssthresh, cg->in_flight);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cg->window += qc->tp.max_udp_payload_size * f->len / cg->window;
|
cg->window += qc->tp.max_udp_payload_size * f->plen / cg->window;
|
||||||
|
|
||||||
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
"quic congestion avoidance win:%uz, ss:%uz, if:%uz",
|
"quic congestion avoidance win:%uz, ss:%uz, if:%uz",
|
||||||
@ -4572,18 +4582,28 @@ ngx_quic_congestion_ack(ngx_connection_t *c, ngx_quic_frame_t *f)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ngx_quic_congestion_lost(ngx_connection_t *c, ngx_msec_t sent)
|
ngx_quic_congestion_lost(ngx_connection_t *c, ngx_quic_frame_t *f)
|
||||||
{
|
{
|
||||||
ngx_msec_t timer;
|
ngx_msec_t timer;
|
||||||
ngx_quic_congestion_t *cg;
|
ngx_quic_congestion_t *cg;
|
||||||
ngx_quic_connection_t *qc;
|
ngx_quic_connection_t *qc;
|
||||||
|
|
||||||
|
if (f->plen == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
qc = c->quic;
|
qc = c->quic;
|
||||||
cg = &qc->congestion;
|
cg = &qc->congestion;
|
||||||
|
|
||||||
timer = sent - cg->recovery_start;
|
cg->in_flight -= f->plen;
|
||||||
|
|
||||||
|
timer = f->last - cg->recovery_start;
|
||||||
|
|
||||||
if ((ngx_msec_int_t) timer <= 0) {
|
if ((ngx_msec_int_t) timer <= 0) {
|
||||||
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
|
"quic congestion lost recovery win:%uz, ss:%uz, if:%uz",
|
||||||
|
cg->window, cg->ssthresh, cg->in_flight);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +248,7 @@ struct ngx_quic_frame_s {
|
|||||||
enum ssl_encryption_level_t level;
|
enum ssl_encryption_level_t level;
|
||||||
ngx_queue_t queue;
|
ngx_queue_t queue;
|
||||||
uint64_t pnum;
|
uint64_t pnum;
|
||||||
|
size_t plen;
|
||||||
ngx_msec_t first;
|
ngx_msec_t first;
|
||||||
ngx_msec_t last;
|
ngx_msec_t last;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
Loading…
Reference in New Issue
Block a user