diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-02-22 16:08:26 +0000 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-03-30 11:14:09 +0100 |
commit | dbe7b51a8e3c0e20c3412fe4ff8309730a135255 (patch) | |
tree | f7ed269c1d1d8d6d2f5690f367bd7f1712620274 | |
parent | 27c49c06f173ce009a00778206a95dfc81618470 (diff) |
Minor fixes to thread assisted mode
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20348)
-rw-r--r-- | include/internal/quic_tserver.h | 4 | ||||
-rw-r--r-- | ssl/quic/quic_impl.c | 4 | ||||
-rw-r--r-- | ssl/quic/quic_thread_assist.c | 3 | ||||
-rw-r--r-- | ssl/quic/quic_tserver.c | 5 |
4 files changed, 13 insertions, 3 deletions
diff --git a/include/internal/quic_tserver.h b/include/internal/quic_tserver.h index 4545630a90..0d0d201497 100644 --- a/include/internal/quic_tserver.h +++ b/include/internal/quic_tserver.h @@ -60,6 +60,9 @@ int ossl_quic_tserver_set_handshake_mutator(QUIC_TSERVER *srv, /* Advances the state machine. */ int ossl_quic_tserver_tick(QUIC_TSERVER *srv); +/* Returns 1 if we have a (non-terminated) client. */ +int ossl_quic_tserver_is_connected(QUIC_TSERVER *srv); + /* * Returns 1 if we have finished the TLS handshake */ @@ -72,6 +75,7 @@ QUIC_TERMINATE_CAUSE ossl_quic_tserver_get_terminate_cause(const QUIC_TSERVER *s /* Returns 1 if the server is in a terminated state */ int ossl_quic_tserver_is_terminated(const QUIC_TSERVER *srv); + /* * Attempts to read from stream 0. Writes the number of bytes read to * *bytes_read and returns 1 on success. If no bytes are available, 0 is written diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 483b694c7d..2c7c247260 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -190,8 +190,10 @@ void ossl_quic_free(SSL *s) quic_lock(qc); /* best effort */ - if (qc->is_thread_assisted && qc->started) + if (qc->is_thread_assisted && qc->started) { ossl_quic_thread_assist_wait_stopped(&qc->thread_assist); + ossl_quic_thread_assist_cleanup(&qc->thread_assist); + } ossl_quic_channel_free(qc->ch); diff --git a/ssl/quic/quic_thread_assist.c b/ssl/quic/quic_thread_assist.c index 9d6c4ecda5..3e2ff1bc6f 100644 --- a/ssl/quic/quic_thread_assist.c +++ b/ssl/quic/quic_thread_assist.c @@ -120,11 +120,10 @@ int ossl_quic_thread_assist_cleanup(QUIC_THREAD_ASSIST *qta) if (!ossl_assert(qta->joined)) return 0; - ossl_crypto_condvar_free(qta->cv); + ossl_crypto_condvar_free(&qta->cv); ossl_crypto_thread_native_clean(qta->t); qta->ch = NULL; - qta->cv = NULL; qta->t = NULL; return 1; } diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c index 110e34a837..27addc9be5 100644 --- a/ssl/quic/quic_tserver.c +++ b/ssl/quic/quic_tserver.c @@ -163,6 +163,11 @@ int ossl_quic_tserver_tick(QUIC_TSERVER *srv) return 1; } +int ossl_quic_tserver_is_connected(QUIC_TSERVER *srv) +{ + return ossl_quic_channel_is_active(srv->ch); +} + /* Returns 1 if the server is in any terminating or terminated state */ int ossl_quic_tserver_is_term_any(const QUIC_TSERVER *srv) { |