From 7abab303670022693e8b5226805c85e03c344362 Mon Sep 17 00:00:00 2001 From: Aloys Augustin Date: Fri, 20 Dec 2019 13:14:00 +0100 Subject: quic: call quic_send_packets only once per ctx This prevents unnecessary calls to quic_send_packets. Type: fix Change-Id: I7abe509aa8b7b9d5a01c9876046cf0f4507a79cf Signed-off-by: Aloys Augustin --- src/plugins/quic/quic.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/plugins/quic/quic.c') diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index dc3b1d4038e..fd848b07331 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -2153,7 +2153,7 @@ static int quic_udp_session_rx_callback (session_t * udp_session) { /* Read data from UDP rx_fifo and pass it to the quicly conn. */ - quic_ctx_t *ctx = NULL; + quic_ctx_t *ctx = NULL, *prev_ctx = NULL; svm_fifo_t *f = udp_session->rx_fifo; u32 max_deq; u64 udp_session_handle = session_handle (udp_session); @@ -2234,8 +2234,10 @@ rx_start: break; } } + ctx = prev_ctx = NULL; for (i = 0; i < max_packets; i++) { + prev_ctx = ctx; switch (packets_ctx[i].ptype) { case QUIC_PACKET_TYPE_RECEIVE: @@ -2250,9 +2252,11 @@ rx_start: packets_ctx[i].thread_index); break; default: - continue; + continue; /* this exits the for loop since other packet types are + necessarily the last in the batch */ } - quic_send_packets (ctx); + if (ctx != prev_ctx) + quic_send_packets (ctx); } udp_session = session_get_from_handle (udp_session_handle); /* session alloc might have happened */ -- cgit 1.2.3-korg