mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-04-28 19:37:57 +03:00
Gracefully handle errors in socket creation (#662)
Some checks are pending
Canary release job / Create tag (push) Waiting to run
Canary release job / Release for linux-arm64 (push) Waiting to run
Canary release job / Release for linux-x64 (push) Waiting to run
Canary release job / Release for win-x64 (push) Waiting to run
Canary release job / Release MacOS universal (push) Waiting to run
Some checks are pending
Canary release job / Create tag (push) Waiting to run
Canary release job / Release for linux-arm64 (push) Waiting to run
Canary release job / Release for linux-x64 (push) Waiting to run
Canary release job / Release for win-x64 (push) Waiting to run
Canary release job / Release MacOS universal (push) Waiting to run
In all other calls, exceptions are handled within the ManagedSocket class, this can't easily be done here as the exception is thrown from the constructor, so the exception is handled in ISocket and the correct error is passed to the application. This should fix #660
This commit is contained in:
parent
61975ca44d
commit
bc07bc482d
1 changed files with 14 additions and 5 deletions
|
@ -101,12 +101,21 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
|||
}
|
||||
}
|
||||
|
||||
ISocket newBsdSocket = new ManagedSocket(netDomain, (SocketType)type, protocol, context.Device.Configuration.MultiplayerLanInterfaceId)
|
||||
{
|
||||
Blocking = !creationFlags.HasFlag(BsdSocketCreationFlags.NonBlocking),
|
||||
};
|
||||
|
||||
LinuxError errno = LinuxError.SUCCESS;
|
||||
ISocket newBsdSocket;
|
||||
|
||||
try
|
||||
{
|
||||
newBsdSocket = new ManagedSocket(netDomain, (SocketType)type, protocol, context.Device.Configuration.MultiplayerLanInterfaceId)
|
||||
{
|
||||
Blocking = !creationFlags.HasFlag(BsdSocketCreationFlags.NonBlocking),
|
||||
};
|
||||
}
|
||||
catch (SocketException exception)
|
||||
{
|
||||
LinuxError errNo = WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
return WriteBsdResult(context, 0, errNo);
|
||||
}
|
||||
|
||||
int newSockFd = _context.RegisterFileDescriptor(newBsdSocket);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue