diff 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
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_connection.h
+++ b/src/event/quic/ngx_event_quic_connection.h
@@ -140,14 +140,6 @@ typedef struct {
 } ngx_quic_congestion_t;
 
 
-struct ngx_quic_frames_stream_s {
-    uint64_t                   sent;
-    uint64_t                   received;
-    ngx_queue_t                frames;   /* reorder queue */
-    size_t                     total;    /* size of buffered data */
-};
-
-
 /*
  * 12.3.  Packet Numbers
  *
@@ -159,6 +151,10 @@ struct ngx_quic_frames_stream_s {
 struct ngx_quic_send_ctx_s {
     enum ssl_encryption_level_t       level;
 
+    ngx_chain_t                      *crypto;
+    uint64_t                          crypto_received;
+    uint64_t                          crypto_sent;
+
     uint64_t                          pnum;        /* to be sent */
     uint64_t                          largest_ack; /* received from peer */
     uint64_t                          largest_pn;  /* received from peer */
@@ -203,8 +199,6 @@ struct ngx_quic_connection_s {
 
     ngx_quic_send_ctx_t               send_ctx[NGX_QUIC_SEND_CTX_LAST];
 
-    ngx_quic_frames_stream_t          crypto[NGX_QUIC_ENCRYPTION_LAST];
-
     ngx_quic_keys_t                  *keys;
 
     ngx_quic_conf_t                  *conf;