quic: call quic_send_packets only once per ctx
This prevents unnecessary calls to quic_send_packets.
Type: fix
@@ -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,8 +2252,10 @@ 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 */
}
+ if (ctx != prev_ctx)
quic_send_packets (ctx);
}
