mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-22 17:46:08 -04:00
fix(multiplayer): Add sleep_for & remove yield for Stabilization
Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
@@ -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 =
|
||||||
|
|||||||
Reference in New Issue
Block a user