aboutsummaryrefslogtreecommitdiff
path: root/src/core/internal_network/socket_proxy.h
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-11-02 21:36:20 +0100
committercirakg <cirakg@cirakg.xyz>2026-11-02 23:00:10 +0100
commit8aafca259892d2f3d573ae4890470bdb7cfc62a8 (patch)
tree19b7f9ce7912e4cd5f0984cfaa11587d29781437 /src/core/internal_network/socket_proxy.h
parente5a2a13175378f2ed8c900432712d4d838dfe8bf (diff)
network: fix ProxySocket receive edge cases
Routing recv() through RecvFrom made several old RecvFrom problems reachable from the normal read path: - A partial TCP read kept zero bytes in front of the unread data. - A blocking read busy-waited with yield() and reported ETIMEDOUT. - MSG_PEEK hit the flags == 0 assert. - A UDP datagram larger than the buffer was dropped with EMSGSIZE. Wait on a condition variable signalled when a packet arrives, and report an expired wait as EAGAIN like an SO_RCVTIMEO timeout. Keep the existing 5s cap for sockets without a receive timeout. Allow MSG_PEEK. Truncate oversized datagrams as BSD recv() does, and keep the unread tail of a TCP packet for the next read. Assisted-by: Claude Opus 5.5 (investigation and implementation)
Diffstat (limited to 'src/core/internal_network/socket_proxy.h')
-rw-r--r--src/core/internal_network/socket_proxy.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/internal_network/socket_proxy.h b/src/core/internal_network/socket_proxy.h
index caf5d1ee23..8343fcbae1 100644
--- a/src/core/internal_network/socket_proxy.h
+++ b/src/core/internal_network/socket_proxy.h
@@ -1,10 +1,11 @@
-// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
+#include <condition_variable>
#include <mutex>
#include <span>
#include <vector>
@@ -92,6 +93,7 @@ private:
Protocol protocol;
std::mutex packets_mutex;
+ std::condition_variable packets_cv;
};
} // namespace Network