mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-18 18:50:50 -04:00
socket_proxy.cpp: Add Mutex & Flush for Socket Protection
Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
@@ -307,9 +307,15 @@ std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, std::span<const u8> message
|
|||||||
}
|
}
|
||||||
|
|
||||||
Errno ProxySocket::Close() {
|
Errno ProxySocket::Close() {
|
||||||
|
std::lock_guard guard(packets_mutex);
|
||||||
fd = INVALID_SOCKET;
|
fd = INVALID_SOCKET;
|
||||||
closed = true;
|
closed = true;
|
||||||
|
|
||||||
|
// Flush any pending packets so they don't get processed after closure
|
||||||
|
while (!received_packets.empty()) {
|
||||||
|
received_packets.pop();
|
||||||
|
}
|
||||||
|
|
||||||
return Errno::SUCCESS;
|
return Errno::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user