]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC FC: Rename stream count mode to reflect actual function
authorHugo Landau <hlandau@openssl.org>
Tue, 25 Jul 2023 10:32:25 +0000 (11:32 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 8 Aug 2023 13:33:42 +0000 (14:33 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21547)

include/internal/quic_fc.h
ssl/quic/quic_channel.c
ssl/quic/quic_fc.c

index ea7161534e0d42ecbe462830c65fb6a50d266022..06a7cc1db0d8d034909a1bc6c94bb61eab65c13c 100644 (file)
@@ -137,7 +137,7 @@ struct quic_rxfc_st {
     OSSL_TIME       (*now)(void *arg);
     void            *now_arg;
     QUIC_RXFC       *parent;
-    unsigned char   error_code, has_cwm_changed, is_fin, stream_count_mode;
+    unsigned char   error_code, has_cwm_changed, is_fin, standalone;
 };
 
 /*
@@ -155,12 +155,14 @@ int ossl_quic_rxfc_init(QUIC_RXFC *rxfc, QUIC_RXFC *conn_rxfc,
                         void *now_arg);
 
 /*
- * Initialises an RX flow controller for stream count enforcement.
+ * Initialises an RX flow controller which is used by itself and not under a
+ * connection-level RX flow controller. This can be used for stream count
+ * enforcement as well as CRYPTO buffer enforcement.
  */
-int ossl_quic_rxfc_init_for_stream_count(QUIC_RXFC *rxfc,
-                                         uint64_t initial_window_size,
-                                         OSSL_TIME (*now)(void *arg),
-                                         void *now_arg);
+int ossl_quic_rxfc_init_standalone(QUIC_RXFC *rxfc,
+                                   uint64_t initial_window_size,
+                                   OSSL_TIME (*now)(void *arg),
+                                   void *now_arg);
 
 /*
  * Gets the parent (i.e., connection-level) RXFC. Returns NULL if called on a
index 9ba756b1d31ccb33ea6b4c99094c47f619285170..bdf6376e2b9a33438ca350076b9cbfd0eef890aa 100644 (file)
@@ -176,14 +176,14 @@ static int ch_init(QUIC_CHANNEL *ch)
                              get_time, ch))
         goto err;
 
-    if (!ossl_quic_rxfc_init_for_stream_count(&ch->max_streams_bidi_rxfc,
-                                              DEFAULT_INIT_CONN_MAX_STREAMS,
-                                              get_time, ch))
+    if (!ossl_quic_rxfc_init_standalone(&ch->max_streams_bidi_rxfc,
+                                        DEFAULT_INIT_CONN_MAX_STREAMS,
+                                        get_time, ch))
         goto err;
 
-    if (!ossl_quic_rxfc_init_for_stream_count(&ch->max_streams_uni_rxfc,
-                                             DEFAULT_INIT_CONN_MAX_STREAMS,
-                                             get_time, ch))
+    if (!ossl_quic_rxfc_init_standalone(&ch->max_streams_uni_rxfc,
+                                        DEFAULT_INIT_CONN_MAX_STREAMS,
+                                        get_time, ch))
         goto err;
 
     if (!ossl_statm_init(&ch->statm))
index caf69a1d67f30e5e19adfdb032a324f6f1ce2617..6cb5834c259f5be070c160a14eeffa2f750e4339 100644 (file)
@@ -146,21 +146,21 @@ int ossl_quic_rxfc_init(QUIC_RXFC *rxfc, QUIC_RXFC *conn_rxfc,
     rxfc->now               = now;
     rxfc->now_arg           = now_arg;
     rxfc->is_fin            = 0;
-    rxfc->stream_count_mode = 0;
+    rxfc->standalone        = 0;
     return 1;
 }
 
-int ossl_quic_rxfc_init_for_stream_count(QUIC_RXFC *rxfc,
-                                         uint64_t initial_window_size,
-                                         OSSL_TIME (*now)(void *arg),
-                                         void *now_arg)
+int ossl_quic_rxfc_init_standalone(QUIC_RXFC *rxfc,
+                                   uint64_t initial_window_size,
+                                   OSSL_TIME (*now)(void *arg),
+                                   void *now_arg)
 {
     if (!ossl_quic_rxfc_init(rxfc, NULL,
                              initial_window_size, initial_window_size,
                              now, now_arg))
         return 0;
 
-    rxfc->stream_count_mode = 1;
+    rxfc->standalone = 1;
     return 1;
 }
 
@@ -200,7 +200,7 @@ int ossl_quic_rxfc_on_rx_stream_frame(QUIC_RXFC *rxfc, uint64_t end, int is_fin)
 {
     uint64_t delta;
 
-    if (!rxfc->stream_count_mode && rxfc->parent == NULL)
+    if (!rxfc->standalone && rxfc->parent == NULL)
         return 0;
 
     if (rxfc->is_fin && ((is_fin && rxfc->hwm != end) || end > rxfc->hwm)) {
@@ -341,7 +341,7 @@ int ossl_quic_rxfc_on_retire(QUIC_RXFC *rxfc,
                              uint64_t num_bytes,
                              OSSL_TIME rtt)
 {
-    if (rxfc->parent == NULL && !rxfc->stream_count_mode)
+    if (rxfc->parent == NULL && !rxfc->standalone)
         return 0;
 
     if (num_bytes == 0)
@@ -353,7 +353,7 @@ int ossl_quic_rxfc_on_retire(QUIC_RXFC *rxfc,
 
     rxfc_on_retire(rxfc, num_bytes, 0, rtt);
 
-    if (!rxfc->stream_count_mode)
+    if (!rxfc->standalone)
         rxfc_on_retire(rxfc->parent, num_bytes, rxfc->cur_window_size, rtt);
 
     return 1;