From: Hugo Landau Date: Fri, 28 Apr 2023 15:56:33 +0000 (+0100) Subject: QUIC TSERVER: Allow detection of new incoming streams X-Git-Tag: openssl-3.2.0-alpha1~790 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1df479a9f95d2862e32c43c89d17d3e094fb2292;p=thirdparty%2Fopenssl.git QUIC TSERVER: Allow detection of new incoming streams Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20856) --- diff --git a/include/internal/quic_tserver.h b/include/internal/quic_tserver.h index 744c34472e7..a040a761fc4 100644 --- a/include/internal/quic_tserver.h +++ b/include/internal/quic_tserver.h @@ -150,6 +150,13 @@ int ossl_quic_tserver_stream_has_peer_reset_stream(QUIC_TSERVER *srv, */ int ossl_quic_tserver_set_new_local_cid(QUIC_TSERVER *srv, const QUIC_CONN_ID *conn_id); + +/* + * Returns the stream ID of the next incoming stream, or UINT64_MAX if there + * currently is none. + */ +uint64_t ossl_quic_tserver_pop_incoming_stream(QUIC_TSERVER *srv); + # endif #endif diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c index 8e15587bece..6788851f298 100644 --- a/ssl/quic/quic_tserver.c +++ b/ssl/quic/quic_tserver.c @@ -404,3 +404,16 @@ int ossl_quic_tserver_set_new_local_cid(QUIC_TSERVER *srv, /* Replace existing local connection ID in the QUIC_CHANNEL */ return ossl_quic_channel_replace_local_cid(srv->ch, conn_id); } + +uint64_t ossl_quic_tserver_pop_incoming_stream(QUIC_TSERVER *srv) +{ + QUIC_STREAM_MAP *qsm = ossl_quic_channel_get_qsm(srv->ch); + QUIC_STREAM *qs = ossl_quic_stream_map_peek_accept_queue(qsm); + + if (qs == NULL) + return UINT64_MAX; + + ossl_quic_stream_map_remove_from_accept_queue(qsm, qs, ossl_time_zero()); + + return qs->id; +}