typedef struct {
ngx_rbtree_t tree;
ngx_rbtree_node_t sentinel;
- ngx_msec_t timeout;
ngx_connection_handler_pt handler;
ngx_uint_t id_counter;
ngx_quic_streams_t streams;
ngx_uint_t max_data;
+ ngx_uint_t send_timer_set;
+ /* unsigned send_timer_set:1 */
#define SSL_ECRYPTION_LAST ((ssl_encryption_application) + 1)
uint64_t crypto_offset[SSL_ECRYPTION_LAST];
return NGX_ERROR;
}
+ if (qc->ctp.max_idle_timeout > 0
+ && qc->ctp.max_idle_timeout < qc->tp.max_idle_timeout)
+ {
+ qc->tp.max_idle_timeout = qc->ctp.max_idle_timeout;
+ }
+
qc->client_tp_done = 1;
}
}
void
ngx_quic_run(ngx_connection_t *c, ngx_ssl_t *ssl, ngx_quic_tp_t *tp,
- ngx_msec_t timeout, ngx_connection_handler_pt handler)
+ ngx_connection_handler_pt handler)
{
ngx_buf_t *b;
ngx_quic_header_t pkt;
// we don't need stream handler for initial packet processing
c->quic->streams.handler = handler;
- c->quic->streams.timeout = timeout;
- ngx_add_timer(c->read, timeout);
+ ngx_add_timer(c->read, c->quic->tp.max_idle_timeout);
c->read->handler = ngx_quic_input_handler;
static void
ngx_quic_input_handler(ngx_event_t *rev)
{
- ssize_t n;
- ngx_buf_t b;
- ngx_connection_t *c;
+ ssize_t n;
+ ngx_buf_t b;
+ ngx_connection_t *c;
+ ngx_quic_connection_t *qc;
static u_char buf[65535];
return;
}
- ngx_add_timer(rev, c->quic->streams.timeout);
-
if (c->close) {
ngx_quic_close_connection(c);
return;
ngx_quic_close_connection(c);
return;
}
+
+ qc = c->quic;
+
+ qc->send_timer_set = 0;
+ ngx_add_timer(rev, qc->tp.max_idle_timeout);
}
qc->frames = NULL;
+ if (!qc->send_timer_set) {
+ qc->send_timer_set = 1;
+ ngx_add_timer(c->read, qc->tp.max_idle_timeout);
+ }
+
return NGX_OK;
}
v3cf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_v3_module);
sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
- ngx_quic_run(c, &sscf->ssl, &v3cf->quic,
- c->listening->post_accept_timeout,
- ngx_http_quic_stream_handler);
+ ngx_quic_run(c, &sscf->ssl, &v3cf->quic, ngx_http_quic_stream_handler);
return;
}
#endif
ngx_http_v3_srv_conf_t *conf = child;
ngx_conf_merge_msec_value(conf->quic.max_idle_timeout,
- prev->quic.max_idle_timeout, 10000);
+ prev->quic.max_idle_timeout, 60000);
// > 2 ^ 14 is invalid
ngx_conf_merge_msec_value(conf->quic.max_ack_delay,