diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-04-18 19:30:55 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-05-12 14:47:12 +0100 |
commit | 5bd9ddd86e714705840215b8d2bbb0aedc598e96 (patch) | |
tree | fcd10c51b0ee7ed96038b44c3c4b11c04d28d1c9 /ssl | |
parent | 999e13f40eda5a2ca39d1efb407b96f81d2b9535 (diff) |
QUIC FC: Modify RXFC to support use for enforcing MAX_STREAMS
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20765)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/quic/quic_fc.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/ssl/quic/quic_fc.c b/ssl/quic/quic_fc.c index 40bdd9909f..b016c02151 100644 --- a/ssl/quic/quic_fc.c +++ b/ssl/quic/quic_fc.c @@ -146,6 +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; + 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) +{ + if (!ossl_quic_rxfc_init(rxfc, NULL, + initial_window_size, initial_window_size, + now, now_arg)) + return 0; + + rxfc->stream_count_mode = 1; return 1; } @@ -185,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->parent == NULL) + if (!rxfc->stream_count_mode && rxfc->parent == NULL) return 0; if (rxfc->is_fin && ((is_fin && rxfc->hwm != end) || end > rxfc->hwm)) { @@ -201,8 +216,9 @@ int ossl_quic_rxfc_on_rx_stream_frame(QUIC_RXFC *rxfc, uint64_t end, int is_fin) delta = end - rxfc->hwm; rxfc->hwm = end; - on_rx_controlled_bytes(rxfc, delta); /* result ignored */ - on_rx_controlled_bytes(rxfc->parent, delta); /* result ignored */ + on_rx_controlled_bytes(rxfc, delta); /* result ignored */ + if (rxfc->parent != NULL) + on_rx_controlled_bytes(rxfc->parent, delta); /* result ignored */ } else if (end < rxfc->hwm && is_fin) { rxfc->error_code = QUIC_ERR_FINAL_SIZE_ERROR; return 1; /* not a caller error */ |