From 3acf35bb985ec40a8498c3e6903ec16f755a9b2e Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:23:43 +0100 Subject: [PATCH 1/5] Update sockets_translate.cpp Add support for the CONNREFUSED Errno. Without this Connect() will return SUCCESS when a connection is refused, instead of an error code. This causes code, that relies on the result of Connect() being SUCCESS, to execute when it shouldn't. --- src/core/hle/service/sockets/sockets_translate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index aed05250c7..ea0b081c29 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp @@ -15,6 +15,8 @@ Errno Translate(Network::Errno value) { switch (value) { case Network::Errno::SUCCESS: return Errno::SUCCESS; + case Network::Errno::CONNREFUSED: + return Errno::CONNREFUSED; case Network::Errno::BADF: return Errno::BADF; case Network::Errno::AGAIN: From c0775e74ec2791cbb278bbe413eda6fb6e128cc4 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:27:11 +0100 Subject: [PATCH 2/5] Update sockets.h Add the CONNREFUSED error to the Service::Sockets::Errno enum --- src/core/hle/service/sockets/sockets.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index f86af01a43..a34a92bbed 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h @@ -19,6 +19,7 @@ enum class Errno : u32 { INVAL = 22, MFILE = 24, PIPE = 32, + CONNREFUSED = 61, MSGSIZE = 90, CONNABORTED = 103, CONNRESET = 104, From 2cc5c517cf9029c278cc07e0fb888f787b78453f Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:34:07 +0100 Subject: [PATCH 3/5] Update sockets_translate.cpp Align the error case with it's index in the Errno enum --- src/core/hle/service/sockets/sockets_translate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index ea0b081c29..21bb3e7764 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp @@ -15,8 +15,6 @@ Errno Translate(Network::Errno value) { switch (value) { case Network::Errno::SUCCESS: return Errno::SUCCESS; - case Network::Errno::CONNREFUSED: - return Errno::CONNREFUSED; case Network::Errno::BADF: return Errno::BADF; case Network::Errno::AGAIN: @@ -27,6 +25,8 @@ Errno Translate(Network::Errno value) { return Errno::MFILE; case Network::Errno::PIPE: return Errno::PIPE; + case Network::Errno::CONNREFUSED: + return Errno::CONNREFUSED; case Network::Errno::NOTCONN: return Errno::NOTCONN; case Network::Errno::TIMEDOUT: From a1ce45b0b1d9c2354f6bccede443cd6f472f2717 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:01:04 +0100 Subject: [PATCH 4/5] Update src/core/hle/service/sockets/sockets.h Co-authored-by: liamwhite --- src/core/hle/service/sockets/sockets.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index a34a92bbed..4079c7728c 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h @@ -19,7 +19,7 @@ enum class Errno : u32 { INVAL = 22, MFILE = 24, PIPE = 32, - CONNREFUSED = 61, + CONNREFUSED = 111, MSGSIZE = 90, CONNABORTED = 103, CONNRESET = 104, From ecea5ef75741fa513b47b8b596fa15e380e1aa5f Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Tue, 30 Jan 2024 12:24:47 +0100 Subject: [PATCH 5/5] Update sockets.h forgot to realign the enum --- src/core/hle/service/sockets/sockets.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index 4079c7728c..f3ea31bde5 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h @@ -19,12 +19,12 @@ enum class Errno : u32 { INVAL = 22, MFILE = 24, PIPE = 32, - CONNREFUSED = 111, MSGSIZE = 90, CONNABORTED = 103, CONNRESET = 104, NOTCONN = 107, TIMEDOUT = 110, + CONNREFUSED = 111, INPROGRESS = 115, };