From 3817dd43630c6a00bffc65a087fc3b8be47d8def Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 15 Feb 2025 18:45:01 +0100 Subject: [PATCH] Skip sendmmsg if there is nothing to send --- common/wivrn_sockets.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/wivrn_sockets.cpp b/common/wivrn_sockets.cpp index f5718aec..7c0b8f51 100644 --- a/common/wivrn_sockets.cpp +++ b/common/wivrn_sockets.cpp @@ -421,6 +421,10 @@ void wivrn::UDP::send_many_raw(std::span packets) thread_local std::vector iovecs; thread_local std::vector mmsgs; thread_local std::vector iv_counters; + + if (packets.empty()) + return; + iovecs.clear(); mmsgs.clear(); iv_counters.clear(); @@ -610,6 +614,10 @@ void wivrn::TCP::send_many_raw(std::span packets) thread_local std::vector iovecs; thread_local std::vector sizes; thread_local std::vector> spans; + + if (packets.empty()) + return; + iovecs.clear(); sizes.clear(); spans.clear();