From e66984bd413a8ed004655e668888e28a0141ed3d Mon Sep 17 00:00:00 2001 From: capitalistspz Date: Thu, 26 Sep 2024 03:51:56 +0100 Subject: [PATCH] Fix periodic hitching when controller paired and connected --- src/input/api/Wiimote/l2cap/L2CapWiimote.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp index b65275b0..515de491 100644 --- a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp +++ b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp @@ -5,20 +5,10 @@ namespace { std::vector s_address; std::mutex s_addressMutex; - bool AttemptConnect(int sockFd, sockaddr_l2 const& addr) + bool AttemptConnect(int& sockFd, const sockaddr_l2& addr) { - for (auto i = 0; i < 3; ++i) - { - if (connect(sockFd, reinterpret_cast(&addr), - sizeof(sockaddr_l2)) == 0) - return true; - cemuLog_logDebug(LogType::Force, "Connection attempt {} failed with error {:x}: {} ", i + 1, errno, - std::strerror(errno)); - if (i == 2) - break; - std::this_thread::sleep_for(std::chrono::milliseconds(300)); - } - return false; + return connect(sockFd, reinterpret_cast(&addr), + sizeof(sockaddr_l2)) == 0; } bool AttemptSetNonBlock(int& sockFd) {