[Network] Close POSIX socket descriptors through sceNetSocketClose
Co-authored-by: Sekai <140012992+SekaixX@users.noreply.github.com>
This commit is contained in:
parent
53f233da9b
commit
ea1dcbcea1
|
|
@ -234,6 +234,12 @@ public static class NetExports
|
||||||
public static int NetSocketClose(CpuContext ctx)
|
public static int NetSocketClose(CpuContext ctx)
|
||||||
{
|
{
|
||||||
var id = unchecked((int)ctx[CpuRegister.Rdi]);
|
var id = unchecked((int)ctx[CpuRegister.Rdi]);
|
||||||
|
if (KernelSocketCompatExports.TryCloseSocketFd(id))
|
||||||
|
{
|
||||||
|
TraceNet("socket.close.posix", id, 0, 0, 0);
|
||||||
|
return ctx.SetReturn(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!_sockets.TryRemove(id, out var socket))
|
if (!_sockets.TryRemove(id, out var socket))
|
||||||
{
|
{
|
||||||
return SetNetError(ctx, NetErrorBadFileDescriptor, NetErrnoBadFileDescriptor);
|
return SetNetError(ctx, NetErrorBadFileDescriptor, NetErrnoBadFileDescriptor);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue