Skip to content

Commit

Permalink
QUIC TSERVER: Allow detection of new incoming streams
Browse files Browse the repository at this point in the history
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #20856)
  • Loading branch information
hlandau committed May 24, 2023
1 parent bc89c9f commit 1df479a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/internal/quic_tserver.h
Expand Up @@ -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
13 changes: 13 additions & 0 deletions ssl/quic/quic_tserver.c
Expand Up @@ -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;
}

0 comments on commit 1df479a

Please sign in to comment.