SSL_set_blocking_mode.3ossl - Man Page

configure blocking mode for a QUIC SSL object

Synopsis

 #include <openssl/ssl.h>

 int SSL_set_blocking_mode(SSL *s, int blocking);
 int SSL_get_blocking_mode(SSL *s);

Description

SSL_set_blocking_mode() can be used to enable or disable blocking mode on a QUIC connection SSL object. By default, blocking is enabled, unless the SSL object is configured to use an underlying read or write BIO which cannot provide a poll descriptor (see BIO_get_rpoll_descriptor(3)), as blocking mode cannot be supported in this case.

To enable blocking mode, call SSL_set_blocking_mode() with blocking set to 1; to disable it, call SSL_set_blocking_mode() with blocking set to 0.

To retrieve the current blocking mode, call SSL_get_blocking_mode().

Blocking mode means that calls such as SSL_read() and SSL_write() will block until the requested operation can be performed. In nonblocking mode, these calls will fail if the requested operation cannot be performed immediately; see SSL_get_error(3).

These functions are only applicable to QUIC connection SSL objects. Other kinds of SSL object, such as those for TLS, automatically function in blocking or nonblocking mode based on whether the underlying network read and write BIOs provided to the SSL object are themselves configured in nonblocking mode.

Where a QUIC connection SSL object is used in nonblocking mode, an application is responsible for ensuring that the SSL object is ticked regularly; see SSL_handle_events(3).

Blocking mode is disabled automatically if the application provides a QUIC connection SSL object with a network BIO which cannot support blocking mode. To re-enable blocking mode in this case, an application must set a network BIO which can support blocking mode and explicitly call SSL_set_blocking_mode().

Return Values

SSL_set_blocking_mode() returns 1 on success and 0 on failure. The function fails if called on a SSL object which does not represent a QUIC connection, or if blocking mode cannot be used for the given connection.

SSL_get_blocking_mode() returns 1 if blocking is currently enabled. It returns -1 if called on an unsupported SSL object.

See Also

SSL_handle_events(3), ssl(7)

History

The SSL_set_blocking_mode() and SSL_get_blocking_mode() functions were added in OpenSSL 3.2.

Referenced By

openssl-quic.7ossl(7), ossl-guide-quic-client-non-block.7ossl(7), ossl-guide-quic-introduction.7ossl(7), ossl-guide-quic-multi-stream.7ossl(7), SSL_accept_stream.3ossl(3), SSL_inject_net_dgram.3ossl(3), SSL_new_stream.3ossl(3), SSL_set_bio.3ossl(3).

The man page SSL_get_blocking_mode.3ossl(3) is an alias of SSL_set_blocking_mode.3ossl(3).

2024-04-04 3.2.1 OpenSSL