aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFruityloops <73552844+fruityloops1@users.noreply.github.com>2022-07-14 09:47:25 +0000
committerGitHub <noreply@github.com>2022-07-14 11:47:25 +0200
commit70ec5def9cc7f02580f33dbef65815f0d7ac2229 (patch)
tree7021653c508822cc329bf03df0e2c22741475b28
parent7853faa334fb6bc86a7d01564a868369cc627bb4 (diff)
BSD: Allow use of DontWait flag in Receive (#3462)1.1.179
-rw-r--r--Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs21
1 files changed, 19 insertions, 2 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs
index 43172ab4..b9adb5cc 100644
--- a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs
+++ b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs
@@ -184,18 +184,35 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
public LinuxError Receive(out int receiveSize, Span<byte> buffer, BsdSocketFlags flags)
{
+ LinuxError result;
+
+ bool shouldBlockAfterOperation = false;
+
try
{
+ if (Blocking && flags.HasFlag(BsdSocketFlags.DontWait))
+ {
+ Blocking = false;
+ shouldBlockAfterOperation = true;
+ }
+
receiveSize = Socket.Receive(buffer, ConvertBsdSocketFlags(flags));
- return LinuxError.SUCCESS;
+ result = LinuxError.SUCCESS;
}
catch (SocketException exception)
{
receiveSize = -1;
- return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
+ result = WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
+ }
+
+ if (shouldBlockAfterOperation)
+ {
+ Blocking = true;
}
+
+ return result;
}
public LinuxError ReceiveFrom(out int receiveSize, Span<byte> buffer, int size, BsdSocketFlags flags, out IPEndPoint remoteEndPoint)