From 1defd0847a70c2add4856be68ddf1aedc7a015de Mon Sep 17 00:00:00 2001
From: gal20 <71563441+gal20@users.noreply.github.com>
Date: Sun, 27 Dec 2020 22:22:48 +0200
Subject: udp client: process packets only for the correct pad

---
 src/input_common/udp/client.cpp | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src/input_common/udp/client.cpp')

diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp
index 17a9225d74..412d578961 100644
--- a/src/input_common/udp/client.cpp
+++ b/src/input_common/udp/client.cpp
@@ -225,6 +225,11 @@ void Client::OnPortInfo([[maybe_unused]] Response::PortInfo data) {
 }
 
 void Client::OnPadData(Response::PadData data, std::size_t client) {
+    // Accept packets only for the correct pad
+    if (static_cast<u8>(clients[client].pad_index) != data.info.id) {
+        return;
+    }
+
     LOG_TRACE(Input, "PadData packet received");
     if (data.packet_counter == clients[client].packet_sequence) {
         LOG_WARNING(
-- 
cgit v1.2.3-70-g09d2