mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 23:11:18 +12:00
Fix periodic hitching when controller paired and connected
This commit is contained in:
parent
00ff45d66b
commit
e6e437be17
1 changed files with 3 additions and 13 deletions
|
@ -5,20 +5,10 @@ namespace {
|
||||||
std::vector<bdaddr_t> s_address;
|
std::vector<bdaddr_t> s_address;
|
||||||
std::mutex s_addressMutex;
|
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)
|
return connect(sockFd, reinterpret_cast<const sockaddr*>(&addr),
|
||||||
{
|
sizeof(sockaddr_l2)) == 0;
|
||||||
if (connect(sockFd, reinterpret_cast<sockaddr const*>(&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;
|
|
||||||
}
|
}
|
||||||
bool AttemptSetNonBlock(int& sockFd)
|
bool AttemptSetNonBlock(int& sockFd)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue