mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-25 06:29:14 +00:00
@@ -38,6 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Operation failed with error {errorCode}.");
|
||||
}
|
||||
|
||||
result = -1;
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
}
|
||||
|
||||
LinuxError errno = LinuxError.SUCCESS;
|
||||
ISocket newBsdSocket;
|
||||
ManagedSocket newBsdSocket;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -412,7 +413,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
{
|
||||
static bool IsUnexpectedLinuxError(LinuxError error)
|
||||
{
|
||||
return error != LinuxError.SUCCESS && error != LinuxError.ETIMEDOUT;
|
||||
return error is not LinuxError.SUCCESS and not LinuxError.ETIMEDOUT;
|
||||
}
|
||||
|
||||
// Hybrid approach
|
||||
@@ -817,7 +818,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
{
|
||||
Logger.Warning?.PrintMsg(LogClass.ServiceBsd, $"Invalid socket fd '{socketFd}'.");
|
||||
}
|
||||
|
||||
|
||||
return WriteBsdResult(context, 0, errno);
|
||||
}
|
||||
|
||||
@@ -933,7 +934,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
{
|
||||
errno = LinuxError.EINVAL;
|
||||
|
||||
if (how >= 0 && how <= 2)
|
||||
if (how is >= 0 and <= 2)
|
||||
{
|
||||
errno = socket.Shutdown((BsdSocketShutdownFlags)how);
|
||||
}
|
||||
@@ -950,7 +951,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
|
||||
LinuxError errno = LinuxError.EINVAL;
|
||||
|
||||
if (how >= 0 && how <= 2)
|
||||
if (how is >= 0 and <= 2)
|
||||
{
|
||||
errno = _context.ShutdownAllSockets((BsdSocketShutdownFlags)how);
|
||||
}
|
||||
@@ -1057,7 +1058,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
return WriteBsdResult(context, newSockFd, errno);
|
||||
}
|
||||
|
||||
|
||||
[CommandCmif(29)] // 7.0.0+
|
||||
// RecvMMsg(u32 fd, u32 vlen, u32 flags, u32 reserved, nn::socket::TimeVal timeout) -> (i32 ret, u32 bsd_errno, buffer<bytes, 6> message);
|
||||
public ResultCode RecvMMsg(ServiceCtx context)
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
|
||||
isValidEvent = true;
|
||||
}
|
||||
|
||||
if (evnt.Data.InputEvents.HasFlag(PollEventTypeMask.Output))
|
||||
{
|
||||
waiters.Add(socket.WriteEvent);
|
||||
@@ -91,7 +92,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
outputEvents |= PollEventTypeMask.Output;
|
||||
}
|
||||
|
||||
|
||||
if (outputEvents != 0)
|
||||
{
|
||||
evnt.Data.OutputEvents = outputEvents;
|
||||
|
||||
@@ -109,6 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -128,6 +129,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -148,6 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Connecting to: {ProtocolType}/***:{remoteEndPoint.Port}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Socket.Connect(remoteEndPoint);
|
||||
@@ -166,6 +169,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -200,6 +204,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -223,6 +228,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -259,6 +265,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
receiveSize = -1;
|
||||
|
||||
result = WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
@@ -314,6 +321,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
receiveSize = -1;
|
||||
|
||||
result = WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
@@ -341,6 +349,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
sendSize = -1;
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
@@ -361,6 +370,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
sendSize = -1;
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
@@ -402,6 +412,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -452,6 +463,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -480,7 +492,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
return true;
|
||||
}
|
||||
|
||||
private static IList<ArraySegment<byte>> ConvertMessagesToBuffer(BsdMMsgHdr message)
|
||||
private static ArraySegment<byte>[] ConvertMessagesToBuffer(BsdMMsgHdr message)
|
||||
{
|
||||
int segmentCount = 0;
|
||||
int index = 0;
|
||||
@@ -588,6 +600,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -630,6 +643,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ServiceBsd, $"Socket Exception: {exception}");
|
||||
}
|
||||
|
||||
return WinSockHelper.ConvertError((WsaError)exception.ErrorCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
enum WsaError
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
FilterSockets(readEvents, readDefault, (socket) => socket.Readable);
|
||||
FilterSockets(writeEvents, writeDefault, (socket) => socket.Writable);
|
||||
@@ -77,6 +77,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy
|
||||
{
|
||||
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Opening socket using host networking stack");
|
||||
}
|
||||
|
||||
return new DefaultSocket(domain, type, protocol, lanInterfaceId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
|
||||
{
|
||||
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
|
||||
enum BsdSocketOption
|
||||
{
|
||||
SoDebug = 0x1,
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
enum LinuxError
|
||||
{
|
||||
SUCCESS = 0,
|
||||
|
||||
@@ -14,10 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
|
||||
class IManager : IpcService
|
||||
{
|
||||
public static readonly NsdSettings NsdSettings;
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private readonly FqdnResolver _fqdnResolver;
|
||||
#pragma warning restore IDE0052
|
||||
|
||||
private readonly bool _isInitialized = false;
|
||||
|
||||
public IManager(ServiceCtx context)
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd.Manager
|
||||
|
||||
public static ResultCode Resolve(string address, out string resolvedAddress)
|
||||
{
|
||||
if (address == "api.sect.srv.nintendo.net" ||
|
||||
address == "ctest.cdn.nintendo.net" ||
|
||||
address == "ctest.cdn.n.nintendoswitch.cn" ||
|
||||
address == "unknown.dummy.nintendo.net")
|
||||
if (address is "api.sect.srv.nintendo.net" or
|
||||
"ctest.cdn.nintendo.net" or
|
||||
"ctest.cdn.n.nintendoswitch.cn" or
|
||||
"unknown.dummy.nintendo.net")
|
||||
{
|
||||
resolvedAddress = address;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user