Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.h @ 8333:167d32476737 quic
Crypto buffer frames reordering.
If offset in CRYPTO frame doesn't match expected, following actions are taken:
a) Duplicate frames or frames within [0...current offset] are ignored
b) New data from intersecting ranges (starts before current_offset, ends
after) is consumed
c) "Future" frames are stored in a sorted queue (min offset .. max offset)
Once a frame is consumed, current offset is updated and the queue is inspected:
we iterate the queue until the gap is found and act as described
above for each frame.
The amount of data in buffered frames is limited by corresponding macro.
The CRYPTO and STREAM frame structures are now compatible: they share
the same set of initial fields. This allows to have code that deals with
both of this frames.
The ordering layer now processes the frame with offset and invokes the
handler when it can organise an ordered stream of data.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Tue, 14 Apr 2020 12:16:25 +0300 |
parents | 1cdd53532309 |
children | 76e8ec502c69 |
comparison
equal
deleted
inserted
replaced
8332:6ad871b63422 | 8333:167d32476737 |
---|---|
109 u_char *ranges_end; | 109 u_char *ranges_end; |
110 } ngx_quic_ack_frame_t; | 110 } ngx_quic_ack_frame_t; |
111 | 111 |
112 | 112 |
113 typedef struct { | 113 typedef struct { |
114 uint64_t offset; | |
115 uint64_t len; | |
116 u_char *data; | |
117 } ngx_quic_crypto_frame_t; | |
118 | |
119 | |
120 typedef struct { | |
121 uint64_t seqnum; | 114 uint64_t seqnum; |
122 uint64_t retire; | 115 uint64_t retire; |
123 uint8_t len; | 116 uint8_t len; |
124 u_char cid[20]; | 117 u_char cid[20]; |
125 u_char srt[16]; | 118 u_char srt[16]; |
126 } ngx_quic_new_conn_id_frame_t; | 119 } ngx_quic_new_conn_id_frame_t; |
127 | 120 |
128 | 121 |
129 typedef struct { | 122 /* |
123 * common layout for CRYPTO and STREAM frames; | |
124 * conceptually, CRYPTO frame is also a stream | |
125 * frame lacking some properties | |
126 */ | |
127 typedef struct { | |
128 uint64_t offset; | |
129 uint64_t length; | |
130 u_char *data; | |
131 } ngx_quic_ordered_frame_t; | |
132 | |
133 typedef ngx_quic_ordered_frame_t ngx_quic_crypto_frame_t; | |
134 | |
135 | |
136 typedef struct { | |
137 /* initial fields same as in ngx_quic_ordered_frame_t */ | |
138 uint64_t offset; | |
139 uint64_t length; | |
140 u_char *data; | |
141 | |
130 uint8_t type; | 142 uint8_t type; |
131 uint64_t stream_id; | 143 uint64_t stream_id; |
132 uint64_t offset; | |
133 uint64_t length; | |
134 unsigned off:1; | 144 unsigned off:1; |
135 unsigned len:1; | 145 unsigned len:1; |
136 unsigned fin:1; | 146 unsigned fin:1; |
137 u_char *data; | |
138 } ngx_quic_stream_frame_t; | 147 } ngx_quic_stream_frame_t; |
139 | 148 |
140 | 149 |
141 typedef struct { | 150 typedef struct { |
142 uint64_t max_data; | 151 uint64_t max_data; |
216 | 225 |
217 u_char *data; | 226 u_char *data; |
218 union { | 227 union { |
219 ngx_quic_ack_frame_t ack; | 228 ngx_quic_ack_frame_t ack; |
220 ngx_quic_crypto_frame_t crypto; | 229 ngx_quic_crypto_frame_t crypto; |
230 ngx_quic_ordered_frame_t ord; | |
221 ngx_quic_new_conn_id_frame_t ncid; | 231 ngx_quic_new_conn_id_frame_t ncid; |
222 ngx_quic_stream_frame_t stream; | 232 ngx_quic_stream_frame_t stream; |
223 ngx_quic_max_data_frame_t max_data; | 233 ngx_quic_max_data_frame_t max_data; |
224 ngx_quic_close_frame_t close; | 234 ngx_quic_close_frame_t close; |
225 ngx_quic_reset_stream_frame_t reset_stream; | 235 ngx_quic_reset_stream_frame_t reset_stream; |