From 8c9c687eaf5f3cb074a57e52d3b25df37412c8ed Mon Sep 17 00:00:00 2001 From: TheLastRar Date: Sat, 12 Apr 2025 16:32:50 +0100 Subject: [PATCH] DEV9: Ignore UDP socket ICMP errors on recv These where already ignored on send --- .../DEV9/Sessions/UDP_Session/UDP_Common.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pcsx2/DEV9/Sessions/UDP_Session/UDP_Common.cpp b/pcsx2/DEV9/Sessions/UDP_Session/UDP_Common.cpp index 23bdbae55e..7268c33f1b 100644 --- a/pcsx2/DEV9/Sessions/UDP_Session/UDP_Common.cpp +++ b/pcsx2/DEV9/Sessions/UDP_Session/UDP_Common.cpp @@ -129,6 +129,7 @@ namespace Sessions::UDP_Common else Console.Error("DEV9: UDP: Socket error: %d", ret); + // All socket errors assumed fatal. return {std::nullopt, false}; } else if (FD_ISSET(client, &sReady)) @@ -159,13 +160,23 @@ namespace Sessions::UDP_Common if (ret == SOCKET_ERROR) { - Console.Error("DEV9: UDP: UDP recv error: %d", #ifdef _WIN32 - WSAGetLastError()); + ret = WSAGetLastError(); #elif defined(__POSIX__) - errno); + ret = errno; +#endif + Console.Error("DEV9: UDP: recvfrom error: %d", ret); + + /* + * We can receive an ICMP Port Unreacable error as a WSAECONNRESET/ECONNREFUSED error + * Ignore the error, recv will be retried next loop + */ + return {std::nullopt, +#ifdef _WIN32 + ret == WSAECONNRESET}; +#elif defined(__POSIX__) + ret == ECONNREFUSED}; #endif - return {std::nullopt, false}; } recived = new PayloadData(ret);