Skip to content

Commit

Permalink
QUIC FC: Rename stream count mode to reflect actual function
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #21547)
  • Loading branch information
hlandau authored and mattcaswell committed Aug 8, 2023
1 parent 7c793cd commit 1051b4a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
14 changes: 8 additions & 6 deletions include/internal/quic_fc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/*
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions ssl/quic/quic_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
18 changes: 9 additions & 9 deletions ssl/quic/quic_fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 1051b4a

Please sign in to comment.