diff options
author | Hugo Landau <hlandau@openssl.org> | 2024-01-22 15:00:05 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2024-02-08 17:50:00 +0100 |
commit | 693d9afef46dbde2f41464052bda994821f536ad (patch) | |
tree | 94def88a54895916a292a73bf77dc85e0f6c04ae /ssl/quic/quic_channel.c | |
parent | QUIC CHANNEL: Defer transport parameter generation (diff) | |
download | openssl-693d9afef46dbde2f41464052bda994821f536ad.tar.xz openssl-693d9afef46dbde2f41464052bda994821f536ad.zip |
QUIC CHANNEL: Fix idle timeout computation bug
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23360)
Diffstat (limited to 'ssl/quic/quic_channel.c')
-rw-r--r-- | ssl/quic/quic_channel.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 48584ffd3a..be36d74399 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -1135,6 +1135,16 @@ static void do_update(QUIC_STREAM *s, void *arg) ossl_quic_stream_map_update_state(&ch->qsm, s); } +static uint64_t min_u64_ignore_0(uint64_t a, uint64_t b) +{ + if (a == 0) + return b; + if (b == 0) + return a; + + return a < b ? a : b; +} + static int ch_on_transport_params(const unsigned char *params, size_t params_len, void *arg) @@ -1426,8 +1436,9 @@ static int ch_on_transport_params(const unsigned char *params, ch->max_idle_timeout_remote_req = v; - if (v > 0 && v < ch->max_idle_timeout) - ch->max_idle_timeout = v; + ch->max_idle_timeout = min_u64_ignore_0(ch->max_idle_timeout_local_req, + ch->max_idle_timeout_remote_req); + ch_update_idle(ch); got_max_idle_timeout = 1; |