From: Hugo Landau Date: Thu, 6 Jul 2023 19:25:26 +0000 (+0100) Subject: QUIC APL: Tick on SSL_read failure in non-blocking mode X-Git-Tag: openssl-3.2.0-alpha1~484 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=780b2527476a60f4a2bb791c2d4b1b72f6f0b423;p=thirdparty%2Fopenssl.git QUIC APL: Tick on SSL_read failure in non-blocking mode ... Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21381) --- diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 2eb16027649..694e15b3893 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -2150,8 +2150,22 @@ static int quic_read(SSL *s, void *buf, size_t len, size_t *bytes_read, int peek ret = 1; } else { - /* We did not get any bytes and are not in blocking mode. */ - ret = QUIC_RAISE_NORMAL_ERROR(&ctx, SSL_ERROR_WANT_READ); + /* + * We did not get any bytes and are not in blocking mode. + * Tick to see if this delivers any more. + */ + ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0); + + /* Try the read again. */ + if (!quic_read_actual(&ctx, ctx.xso->stream, buf, len, bytes_read, peek)) { + ret = 0; /* quic_read_actual raised error here */ + goto out; + } + + if (*bytes_read > 0) + ret = 1; /* Succeeded this time. */ + else + ret = QUIC_RAISE_NORMAL_ERROR(&ctx, SSL_ERROR_WANT_READ); } out: