Mercurial > hg > nginx-quic
comparison src/event/ngx_event_quic.c @ 8176:69dc750cf66f quic
QUIC: handle more frames in ngx_quic_resend_frames().
When a packet is declared lost, its frames are handled differently according to
13.3. Retransmission of Information.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 29 Oct 2020 14:25:02 +0000 |
parents | 64405f970f6f |
children | bb3f4f669417 |
comparison
equal
deleted
inserted
replaced
8175:64405f970f6f | 8176:69dc750cf66f |
---|---|
4830 | 4830 |
4831 | 4831 |
4832 static void | 4832 static void |
4833 ngx_quic_resend_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx) | 4833 ngx_quic_resend_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx) |
4834 { | 4834 { |
4835 size_t n; | |
4836 ngx_buf_t *b; | |
4835 ngx_queue_t *q; | 4837 ngx_queue_t *q; |
4836 ngx_quic_frame_t *f, *start; | 4838 ngx_quic_frame_t *f, *start; |
4839 ngx_quic_stream_t *sn; | |
4837 ngx_quic_connection_t *qc; | 4840 ngx_quic_connection_t *qc; |
4838 | 4841 |
4839 qc = c->quic; | 4842 qc = c->quic; |
4840 q = ngx_queue_head(&ctx->sent); | 4843 q = ngx_queue_head(&ctx->sent); |
4841 start = ngx_queue_data(q, ngx_quic_frame_t, queue); | 4844 start = ngx_queue_data(q, ngx_quic_frame_t, queue); |
4861 case NGX_QUIC_FT_ACK_ECN: | 4864 case NGX_QUIC_FT_ACK_ECN: |
4862 /* force generation of most recent acknowledgment */ | 4865 /* force generation of most recent acknowledgment */ |
4863 ctx->send_ack = NGX_QUIC_MAX_ACK_GAP; | 4866 ctx->send_ack = NGX_QUIC_MAX_ACK_GAP; |
4864 ngx_quic_free_frame(c, f); | 4867 ngx_quic_free_frame(c, f); |
4865 break; | 4868 break; |
4869 | |
4870 case NGX_QUIC_FT_PING: | |
4871 case NGX_QUIC_FT_PATH_RESPONSE: | |
4872 case NGX_QUIC_FT_CONNECTION_CLOSE: | |
4873 ngx_quic_free_frame(c, f); | |
4874 break; | |
4875 | |
4876 case NGX_QUIC_FT_MAX_DATA: | |
4877 f->u.max_data.max_data = qc->streams.recv_max_data; | |
4878 ngx_quic_queue_frame(qc, f); | |
4879 break; | |
4880 | |
4881 case NGX_QUIC_FT_MAX_STREAMS: | |
4882 case NGX_QUIC_FT_MAX_STREAMS2: | |
4883 f->u.max_streams.limit = f->u.max_streams.bidi | |
4884 ? qc->streams.client_max_streams_bidi | |
4885 : qc->streams.client_max_streams_uni; | |
4886 ngx_quic_queue_frame(qc, f); | |
4887 break; | |
4888 | |
4889 case NGX_QUIC_FT_MAX_STREAM_DATA: | |
4890 sn = ngx_quic_find_stream(&qc->streams.tree, | |
4891 f->u.max_stream_data.id); | |
4892 if (sn == NULL) { | |
4893 ngx_quic_free_frame(c, f); | |
4894 break; | |
4895 } | |
4896 | |
4897 b = sn->b; | |
4898 n = sn->fs.received + (b->pos - b->start) + (b->end - b->last); | |
4899 | |
4900 if (f->u.max_stream_data.limit < n) { | |
4901 f->u.max_stream_data.limit = n; | |
4902 } | |
4903 | |
4904 ngx_quic_queue_frame(qc, f); | |
4905 break; | |
4906 | |
4907 case NGX_QUIC_FT_STREAM0: | |
4908 case NGX_QUIC_FT_STREAM1: | |
4909 case NGX_QUIC_FT_STREAM2: | |
4910 case NGX_QUIC_FT_STREAM3: | |
4911 case NGX_QUIC_FT_STREAM4: | |
4912 case NGX_QUIC_FT_STREAM5: | |
4913 case NGX_QUIC_FT_STREAM6: | |
4914 case NGX_QUIC_FT_STREAM7: | |
4915 sn = ngx_quic_find_stream(&qc->streams.tree, f->u.stream.stream_id); | |
4916 | |
4917 if (sn && sn->c->write->error) { | |
4918 /* RESET_STREAM was sent */ | |
4919 ngx_quic_free_frame(c, f); | |
4920 break; | |
4921 } | |
4922 | |
4923 /* fall through */ | |
4866 | 4924 |
4867 default: | 4925 default: |
4868 ngx_queue_insert_tail(&ctx->frames, &f->queue); | 4926 ngx_queue_insert_tail(&ctx->frames, &f->queue); |
4869 } | 4927 } |
4870 | 4928 |