comparison src/event/quic/ngx_event_quic_connection.h @ 8782:b3f6ad181df4 quic

QUIC: refactored CRYPTO and STREAM buffer ordering. Generic function ngx_quic_order_bufs() is introduced. This function creates and maintains a chain of buffers with holes. Holes are marked with b->sync flag. Several buffers and holes in this chain may share the same underlying memory buffer. When processing STREAM frames with this function, frame data is copied only once to the right place in the stream input chain. Previously data could be copied twice. First when buffering an out-of-order frame data, and then when filling stream buffer from ordered frame queue. Now there's only one data chain for both tasks.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 25 May 2021 13:55:12 +0300
parents 0bd1dd39a08b
children af33d1ef1c3c
comparison
equal deleted inserted replaced
8781:81d491f0dc8c 8782:b3f6ad181df4
138 size_t ssthresh; 138 size_t ssthresh;
139 ngx_msec_t recovery_start; 139 ngx_msec_t recovery_start;
140 } ngx_quic_congestion_t; 140 } ngx_quic_congestion_t;
141 141
142 142
143 struct ngx_quic_frames_stream_s {
144 uint64_t sent;
145 uint64_t received;
146 ngx_queue_t frames; /* reorder queue */
147 size_t total; /* size of buffered data */
148 };
149
150
151 /* 143 /*
152 * 12.3. Packet Numbers 144 * 12.3. Packet Numbers
153 * 145 *
154 * Conceptually, a packet number space is the context in which a packet 146 * Conceptually, a packet number space is the context in which a packet
155 * can be processed and acknowledged. Initial packets can only be sent 147 * can be processed and acknowledged. Initial packets can only be sent
157 * are also Initial packets. 149 * are also Initial packets.
158 */ 150 */
159 struct ngx_quic_send_ctx_s { 151 struct ngx_quic_send_ctx_s {
160 enum ssl_encryption_level_t level; 152 enum ssl_encryption_level_t level;
161 153
154 ngx_chain_t *crypto;
155 uint64_t crypto_received;
156 uint64_t crypto_sent;
157
162 uint64_t pnum; /* to be sent */ 158 uint64_t pnum; /* to be sent */
163 uint64_t largest_ack; /* received from peer */ 159 uint64_t largest_ack; /* received from peer */
164 uint64_t largest_pn; /* received from peer */ 160 uint64_t largest_pn; /* received from peer */
165 161
166 ngx_queue_t frames; 162 ngx_queue_t frames;
201 ngx_quic_tp_t tp; 197 ngx_quic_tp_t tp;
202 ngx_quic_tp_t ctp; 198 ngx_quic_tp_t ctp;
203 199
204 ngx_quic_send_ctx_t send_ctx[NGX_QUIC_SEND_CTX_LAST]; 200 ngx_quic_send_ctx_t send_ctx[NGX_QUIC_SEND_CTX_LAST];
205 201
206 ngx_quic_frames_stream_t crypto[NGX_QUIC_ENCRYPTION_LAST];
207
208 ngx_quic_keys_t *keys; 202 ngx_quic_keys_t *keys;
209 203
210 ngx_quic_conf_t *conf; 204 ngx_quic_conf_t *conf;
211 205
212 ngx_event_t push; 206 ngx_event_t push;