]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC TSERVER: Allow detection of new incoming streams
authorHugo Landau <hlandau@openssl.org>
Fri, 28 Apr 2023 15:56:33 +0000 (16:56 +0100)
committerHugo Landau <hlandau@openssl.org>
Wed, 24 May 2023 09:34:47 +0000 (10:34 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20856)

include/internal/quic_tserver.h
ssl/quic/quic_tserver.c

index 744c34472e7a6c15d59e2ac7f065f73e18ed9076..a040a761fc41af77339ddd490bdc62849fba1fd2 100644 (file)
@@ -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
index 8e15587bece8ab85a0d4711ce6a603c9c1f90894..6788851f29879dd8f274d2d2dd04bc44e0b27fa2 100644 (file)
@@ -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;
+}