Mercurial > hg > nginx-quic
comparison src/event/quic/ngx_event_quic.c @ 8320:98bacfc65c61 quic
QUIC: set idle timer when sending an ack-eliciting packet.
As per quic-transport-34:
An endpoint also restarts its idle timer when sending an ack-eliciting
packet if no other ack-eliciting packets have been sent since last receiving
and processing a packet.
Previously, the timer was set for any packet.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 18 Feb 2021 12:22:28 +0300 |
parents | d710c457171c |
children | 81bb3a690c10 |
comparison
equal
deleted
inserted
replaced
8319:ffcaf0aad9f2 | 8320:98bacfc65c61 |
---|---|
4946 | 4946 |
4947 static ngx_int_t | 4947 static ngx_int_t |
4948 ngx_quic_output(ngx_connection_t *c) | 4948 ngx_quic_output(ngx_connection_t *c) |
4949 { | 4949 { |
4950 off_t max; | 4950 off_t max; |
4951 size_t len, min; | 4951 size_t len, min, in_flight; |
4952 ssize_t n; | 4952 ssize_t n; |
4953 u_char *p; | 4953 u_char *p; |
4954 ngx_uint_t i, pad; | 4954 ngx_uint_t i, pad; |
4955 ngx_quic_send_ctx_t *ctx; | 4955 ngx_quic_send_ctx_t *ctx; |
4956 ngx_quic_congestion_t *cg; | |
4956 ngx_quic_connection_t *qc; | 4957 ngx_quic_connection_t *qc; |
4957 static u_char dst[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE]; | 4958 static u_char dst[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE]; |
4958 | 4959 |
4959 c->log->action = "sending frames"; | 4960 c->log->action = "sending frames"; |
4960 | 4961 |
4961 qc = ngx_quic_get_connection(c); | 4962 qc = ngx_quic_get_connection(c); |
4963 cg = &qc->congestion; | |
4964 | |
4965 in_flight = cg->in_flight; | |
4962 | 4966 |
4963 for ( ;; ) { | 4967 for ( ;; ) { |
4964 p = dst; | 4968 p = dst; |
4965 | 4969 |
4966 len = ngx_min(qc->ctp.max_udp_payload_size, | 4970 len = ngx_min(qc->ctp.max_udp_payload_size, |
5001 | 5005 |
5002 n = ngx_quic_send(c, dst, len); | 5006 n = ngx_quic_send(c, dst, len); |
5003 if (n == NGX_ERROR) { | 5007 if (n == NGX_ERROR) { |
5004 return NGX_ERROR; | 5008 return NGX_ERROR; |
5005 } | 5009 } |
5006 | 5010 } |
5007 if (!qc->send_timer_set && !qc->closing) { | 5011 |
5008 qc->send_timer_set = 1; | 5012 if (in_flight != cg->in_flight && !qc->send_timer_set && !qc->closing) { |
5009 ngx_add_timer(c->read, qc->tp.max_idle_timeout); | 5013 qc->send_timer_set = 1; |
5010 } | 5014 ngx_add_timer(c->read, qc->tp.max_idle_timeout); |
5011 } | 5015 } |
5012 | 5016 |
5013 ngx_quic_set_lost_timer(c); | 5017 ngx_quic_set_lost_timer(c); |
5014 | 5018 |
5015 return NGX_OK; | 5019 return NGX_OK; |