void
ngx_quic_congestion_ack(ngx_connection_t *c, ngx_quic_frame_t *f)
{
+ ngx_uint_t blocked;
ngx_msec_t timer;
ngx_quic_congestion_t *cg;
ngx_quic_connection_t *qc;
qc = ngx_quic_get_connection(c);
cg = &qc->congestion;
+ blocked = (cg->in_flight >= cg->window) ? 1 : 0;
+
cg->in_flight -= f->plen;
timer = f->last - cg->recovery_start;
"quic congestion ack recovery win:%uz ss:%z if:%uz",
cg->window, cg->ssthresh, cg->in_flight);
- return;
+ goto done;
}
if (cg->window < cg->ssthresh) {
if ((ngx_msec_int_t) timer < 0) {
cg->recovery_start = ngx_current_msec - qc->tp.max_idle_timeout * 2;
}
+
+done:
+
+ if (blocked && cg->in_flight < cg->window) {
+ ngx_post_event(&qc->push, &ngx_posted_events);
+ }
}
static void
ngx_quic_congestion_lost(ngx_connection_t *c, ngx_quic_frame_t *f)
{
+ ngx_uint_t blocked;
ngx_msec_t timer;
ngx_quic_congestion_t *cg;
ngx_quic_connection_t *qc;
qc = ngx_quic_get_connection(c);
cg = &qc->congestion;
+ blocked = (cg->in_flight >= cg->window) ? 1 : 0;
+
cg->in_flight -= f->plen;
f->plen = 0;
"quic congestion lost recovery win:%uz ss:%z if:%uz",
cg->window, cg->ssthresh, cg->in_flight);
- return;
+ goto done;
}
cg->recovery_start = ngx_current_msec;
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
"quic congestion lost win:%uz ss:%z if:%uz",
cg->window, cg->ssthresh, cg->in_flight);
+
+done:
+
+ if (blocked && cg->in_flight < cg->window) {
+ ngx_post_event(&qc->push, &ngx_posted_events);
+ }
}
ngx_uint_t i, pad;
ngx_quic_path_t *path;
ngx_quic_send_ctx_t *ctx;
+ ngx_quic_congestion_t *cg;
ngx_quic_connection_t *qc;
static u_char dst[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE];
qc = ngx_quic_get_connection(c);
+ cg = &qc->congestion;
path = qsock->path;
- for ( ;; ) {
+ while (cg->in_flight < cg->window) {
+
p = dst;
len = ngx_min(qc->ctp.max_udp_payload_size,
ngx_uint_t nseg;
ngx_quic_path_t *path;
ngx_quic_send_ctx_t *ctx;
+ ngx_quic_congestion_t *cg;
ngx_quic_connection_t *qc;
static u_char dst[NGX_QUIC_MAX_UDP_SEGMENT_BUF];
qc = ngx_quic_get_connection(c);
+ cg = &qc->congestion;
path = qsock->path;
ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_application);
len = ngx_min(segsize, (size_t) (end - p));
- if (len) {
+ if (len && cg->in_flight < cg->window) {
n = ngx_quic_output_packet(c, ctx, p, len, len, qsock);
if (n == NGX_ERROR) {
ngx_queue_t *q;
ngx_quic_frame_t *f;
ngx_quic_header_t pkt;
- ngx_quic_congestion_t *cg;
ngx_quic_connection_t *qc;
static u_char src[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE];
max, min);
qc = ngx_quic_get_connection(c);
- cg = &qc->congestion;
hlen = (ctx->level == ssl_encryption_application)
? NGX_QUIC_MAX_SHORT_HEADER
{
f = ngx_queue_data(q, ngx_quic_frame_t, queue);
- if (!pkt.need_ack && f->need_ack && max > cg->window) {
- max = cg->window;
- }
-
if (f->type == NGX_QUIC_FT_PATH_RESPONSE
|| f->type == NGX_QUIC_FT_PATH_CHALLENGE)
{