SSL_ACCEPT_STREAM(3ossl)
π SSL_ACCEPT_STREAM(3ossl) β the OpenSSL manual page, but make it make sense π
okay bestie so you're here because you're doing QUIC stuff and you need to grab incoming streams off a connection. this is the OpenSSL page for SSL_accept_stream, SSL_get_accept_stream_queue_len, and SSL_ACCEPT_STREAM_NO_BLOCK. it's giving "accept an incoming QUIC stream from a QUIC peer" and honestly? iconic. let's get into it π¦
β¨ NAME β¨
SSL_accept_stream, SSL_get_accept_stream_queue_len, SSL_ACCEPT_STREAM_NO_BLOCK β accept an incoming QUIC stream from a QUIC peer π«Ά
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
#define SSL_ACCEPT_STREAM_NO_BLOCK
SSL *SSL_accept_stream(SSL *ssl, uint64_t flags);
size_t SSL_get_accept_stream_queue_len(SSL *ssl);
yes the include goes at the top, yes it's openssl/ssl.h, no you don't get to skip it π
β¨ DESCRIPTION β¨
so. SSL_accept_stream() tries to dequeue an incoming stream from the given QUIC connection SSL object, and it hands you back the freshly allocated QUIC stream SSL object. that's the whole vibe. πΈ
if the queue of incoming streams is empty, this function returns NULL (in nonblocking mode) or it just sits there and waits for an incoming stream (in blocking mode). and heads up β even in blocking mode it can still return NULL, like if the underlying connection gets terminated. so yeah, NULL in blocking mode isn't a glitch, it's a real possibility π
you are responsible for managing the lifetime of the returned QUIC stream SSL object. that's on you, bestie. for more info, go look at SSL_free(3).
this function will block if the QUIC connection SSL object is configured in blocking mode (peep SSL_set_blocking_mode(3)), but you can bypass that by passing the flag SSL_ACCEPT_STREAM_NO_BLOCK in flags. if that flag is set, this function never blocks. periodt.
β οΈ real talk: callingSSL_accept_stream()when there's no default stream already present inhibits the future creation of a default stream. seeopenssl-quic(7)for the deets. don't say I didn't warn you π
SSL_get_accept_stream_queue_len() returns the number of incoming streams currently waiting in the accept queue. just a lil headcount. β¨
these functions can be used from multiple threads for the same QUIC connection, which is lowkey slay π₯
depending on whether default stream functionality is being used, it may be necessary to explicitly configure the incoming stream policy before streams can be accepted β see SSL_set_incoming_stream_policy(3). also check out "MODES OF OPERATION" in openssl-quic(7) for more info on default stream functionality. iykyk π§
β¨ RETURN VALUES β¨
SSL_accept_stream() returns a newly allocated QUIC stream SSL object, or NULL if:
- no new incoming streams are available, or
- the connection has been terminated, or
- it was called on an SSL object other than a QUIC connection SSL object.
in that case you can hit up SSL_get_error(3) to get further information. it's giving "here's the receipts" π
SSL_get_accept_stream_queue_len() returns the number of incoming streams currently waiting in the accept queue, or 0 if it was called on an SSL object other than a QUIC connection SSL object. zero. nada. not a QUIC connection, bestie. π
β¨ SEE ALSO β¨
"MODES OF OPERATION"inopenssl-quic(7)SSL_new_stream(3)SSL_set_blocking_mode(3)SSL_free(3)
go read them, they're all part of the same friend group π«Ά
β¨ HISTORY β¨
SSL_accept_stream() and SSL_get_accept_stream_queue_len() were added in OpenSSL 3.2. so if you're on something older, that's why nothing's working. not me being the bearer of bad news π
β¨ COPYRIGHT β¨
Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved. π
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page, you ate that π
this was the OpenSSL 3.5.9 version, dated 2026-09-29, and the manual name was SSL_ACCEPT_STREAM(3ossl) β go forth and accept those streams, main character ππβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms