diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-07-18 16:12:44 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2023-07-31 14:03:25 +0100 |
commit | 3415677eec8e0b474973115ad871430f11ced3fd (patch) | |
tree | 1866e9183fbea5f0575b97c89bf8992c653fa89b /ssl/quic/quic_impl.c | |
parent | 03b3859501b69d48c8710b6a0754842c7166a7c1 (diff) |
QUIC APL: Add internal call to allow changing send buffer size
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21484)
Diffstat (limited to 'ssl/quic/quic_impl.c')
-rw-r--r-- | ssl/quic/quic_impl.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index d9bdf74efe..2775a4b938 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -2899,6 +2899,41 @@ int ossl_quic_get_stream_write_error_code(SSL *ssl, uint64_t *app_error_code) } /* + * Write buffer size mutation + * -------------------------- + */ +int ossl_quic_set_write_buffer_size(SSL *ssl, size_t size) +{ + int ret = 0; + QCTX ctx; + + if (!expect_quic_with_stream_lock(ssl, /*remote_init=*/-1, &ctx)) + return 0; + + if (!ossl_quic_stream_has_send(ctx.xso->stream)) + /* Called on a unidirectional receive-only stream - error. */ + goto out; + + if (!ossl_quic_stream_has_send_buffer(ctx.xso->stream)) { + /* + * If the stream has a send part but we have disposed of it because we + * no longer need it, this is a no-op. + */ + ret = 1; + goto out; + } + + if (!ossl_quic_sstream_set_buffer_size(ctx.xso->stream->sstream, size)) + goto out; + + ret = 1; + +out: + quic_unlock(ctx.qc); + return ret; +} + +/* * SSL_get_conn_close_info * ----------------------- */ |