fix(multiplayer): Add sleep_for & remove yield for Stabilization

Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
Collecting
2026-01-22 05:31:36 +01:00
parent 550b08335e
commit cc85173fa9

View File

@@ -34,14 +34,13 @@ void ProxySocket::HandleProxyPacket(const ProxyPacket& packet) {
const auto my_ip = room_member->GetFakeIpAddress(); const auto my_ip = room_member->GetFakeIpAddress();
// If the sender (local_endpoint) is OUR IP, ignore it. // 1. Ignore our own echo
// We don't want to process our own sent packets.
if (packet.local_endpoint.ip == my_ip) { if (packet.local_endpoint.ip == my_ip) {
return; return;
} }
// Only accept packets meant for us or actual broadcasts. // 2. Ignore packets meant for other people
if (packet.remote_endpoint.ip != my_ip && !packet.broadcast) { if (!packet.broadcast && packet.remote_endpoint.ip != my_ip) {
return; return;
} }
@@ -173,7 +172,7 @@ std::pair<s32, Errno> ProxySocket::RecvFrom(int flags, std::span<u8> message, So
return {-1, Errno::AGAIN}; return {-1, Errno::AGAIN};
} }
std::this_thread::yield(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
const auto time_diff = std::chrono::steady_clock::now() - timestamp; const auto time_diff = std::chrono::steady_clock::now() - timestamp;
const auto time_diff_ms = const auto time_diff_ms =