Skip to content

Commit

Permalink
QUIC APL: Add internal call to allow changing send buffer size
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #21484)
  • Loading branch information
hlandau authored and mattcaswell committed Jul 31, 2023
1 parent 03b3859 commit 3415677
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/internal/quic_ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ uint64_t ossl_quic_set_options(SSL *s, uint64_t opts);
uint64_t ossl_quic_clear_options(SSL *s, uint64_t opts);
uint64_t ossl_quic_get_options(const SSL *s);

/* Modifies write buffer size for a stream. */
__owur int ossl_quic_set_write_buffer_size(SSL *s, size_t size);

/*
* Used to override ossl_time_now() for debug purposes. While this may be
* overridden at any time, expect strange results if you change it after
Expand Down
35 changes: 35 additions & 0 deletions ssl/quic/quic_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2898,6 +2898,41 @@ int ossl_quic_get_stream_write_error_code(SSL *ssl, uint64_t *app_error_code)
return quic_get_stream_error_code(ssl, /*is_write=*/1, 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
* -----------------------
Expand Down

0 comments on commit 3415677

Please sign in to comment.