diff src/event/quic/ngx_event_quic_connection.h @ 9147:58afcd72446f

QUIC: path MTU discovery. MTU selection starts by doubling the initial MTU until the first failure. Then binary search is used to find the path MTU.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 14 Aug 2023 09:21:27 +0400
parents bba136612fe4
children 2880f60a80c3
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_connection.h	Tue Aug 08 10:43:17 2023 +0400
+++ b/src/event/quic/ngx_event_quic_connection.h	Mon Aug 14 09:21:27 2023 +0400
@@ -66,6 +66,14 @@
 #define ngx_quic_get_socket(c)               ((ngx_quic_socket_t *)((c)->udp))
 
 
+typedef enum {
+    NGX_QUIC_PATH_IDLE = 0,
+    NGX_QUIC_PATH_VALIDATING,
+    NGX_QUIC_PATH_WAITING,
+    NGX_QUIC_PATH_MTUD
+} ngx_quic_path_state_e;
+
+
 struct ngx_quic_client_id_s {
     ngx_queue_t                       queue;
     uint64_t                          seqnum;
@@ -89,18 +97,22 @@
     ngx_sockaddr_t                    sa;
     socklen_t                         socklen;
     ngx_quic_client_id_t             *cid;
+    ngx_quic_path_state_e             state;
     ngx_msec_t                        expires;
     ngx_uint_t                        tries;
     ngx_uint_t                        tag;
+    size_t                            mtu;
+    size_t                            mtud;
+    size_t                            max_mtu;
     off_t                             sent;
     off_t                             received;
     u_char                            challenge1[8];
     u_char                            challenge2[8];
     uint64_t                          seqnum;
+    uint64_t                          mtu_pnum[NGX_QUIC_PATH_RETRIES];
     ngx_str_t                         addr_text;
     u_char                            text[NGX_SOCKADDR_STRLEN];
-    unsigned                          validated:1;
-    unsigned                          validating:1;
+    ngx_uint_t                        validated; /* unsigned validated:1; */
 };