summaryrefslogtreecommitdiff
path: root/ssl
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2022-11-22 17:56:18 +0000
committerHugo Landau <hlandau@openssl.org>2023-01-13 13:20:17 +0000
commit3bf4dc8c2106982d4ae6ada0650383e60f96d6e6 (patch)
tree87f0dc2aa856bb80cf906adf49bcf7866d83e84e /ssl
parent92282a17c9959bc61e012e93517320df1ec8ace8 (diff)
downloadopenssl-new-3bf4dc8c2106982d4ae6ada0650383e60f96d6e6.tar.gz
QUIC CHANNEL: Only pump the demuxer once per tick
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19703)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/quic/quic_channel.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c
index e02773a430..fc42e65ee6 100644
--- a/ssl/quic/quic_channel.c
+++ b/ssl/quic/quic_channel.c
@@ -18,6 +18,7 @@
#define INIT_CRYPTO_BUF_LEN 8192
#define INIT_APP_BUF_LEN 8192
+static void ch_rx_pre(QUIC_CHANNEL *ch);
static int ch_rx(QUIC_CHANNEL *ch);
static int ch_tx(QUIC_CHANNEL *ch);
static void ch_tick(QUIC_TICK_RESULT *res, void *arg);
@@ -1007,8 +1008,11 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
}
}
+ /* Handle any incoming data from network. */
+ ch_rx_pre(ch);
+
do {
- /* Handle any incoming data from the network. */
+ /* Process queued incoming packets. */
ch_rx(ch);
/*
@@ -1062,7 +1066,20 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
res->want_net_write = (ossl_qtx_get_queue_len_datagrams(ch->qtx) > 0);
}
-/* Process incoming packets and handle frames, if any. */
+/* Process incoming datagrams, if any. */
+static void ch_rx_pre(QUIC_CHANNEL *ch)
+{
+ if (!ch->have_sent_any_pkt)
+ return;
+
+ /*
+ * Get DEMUX to BIO_recvmmsg from the network and queue incoming datagrams
+ * to the appropriate QRX instance.
+ */
+ ossl_quic_demux_pump(ch->demux); /* best effort */
+}
+
+/* Process queued incoming packets and handle frames, if any. */
static int ch_rx(QUIC_CHANNEL *ch)
{
int handled_any = 0;
@@ -1074,12 +1091,6 @@ static int ch_rx(QUIC_CHANNEL *ch)
*/
return 1;
- /*
- * Get DEMUX to BIO_recvmmsg from the network and queue incoming datagrams
- * to the appropriate QRX instance.
- */
- ossl_quic_demux_pump(ch->demux); /* best effort */
-
for (;;) {
assert(ch->qrx_pkt == NULL);