Add socket cleanup.

Don't know what to do with remaining sockops if called from a SetRegister reset command.
This commit is contained in:
Matthew Parlane 2013-08-28 00:37:45 +12:00
parent 6748d5d087
commit d493525050
3 changed files with 9 additions and 13 deletions

View File

@ -55,6 +55,7 @@ CWII_IPC_HLE_Device_net_kd_request::CWII_IPC_HLE_Device_net_kd_request(u32 _Devi
CWII_IPC_HLE_Device_net_kd_request::~CWII_IPC_HLE_Device_net_kd_request() CWII_IPC_HLE_Device_net_kd_request::~CWII_IPC_HLE_Device_net_kd_request()
{ {
WiiSockMan::getInstance().clean();
} }
bool CWII_IPC_HLE_Device_net_kd_request::Open(u32 _CommandAddress, u32 _Mode) bool CWII_IPC_HLE_Device_net_kd_request::Open(u32 _CommandAddress, u32 _Mode)
@ -680,6 +681,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
fd, ReturnValue); fd, ReturnValue);
break; break;
} }
case IOCTL_SO_ACCEPT:
case IOCTL_SO_BIND: case IOCTL_SO_BIND:
case IOCTL_SO_CONNECT: case IOCTL_SO_CONNECT:
case IOCTL_SO_FCNTL: case IOCTL_SO_FCNTL:
@ -690,20 +692,9 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
return false; return false;
break; break;
} }
case IOCTL_SO_ACCEPT:
{
u32 fd = Memory::Read_U32(BufferIn);
WiiSockMan &sm = WiiSockMan::getInstance();
sm.doSock(fd, _CommandAddress, (NET_IOCTL)Command);
return false;
break;
}
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// TODO: ALL BELOW // // TODO: Tidy all below //
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
case IOCTL_SO_SHUTDOWN: case IOCTL_SO_SHUTDOWN:
{ {
WARN_LOG(WII_IPC_NET, "IOCTL_SO_SHUTDOWN " WARN_LOG(WII_IPC_NET, "IOCTL_SO_SHUTDOWN "

View File

@ -628,7 +628,7 @@ void WiiSockMan::Convert(WiiSockAddrIn const & from, sockaddr_in& to)
void WiiSockMan::Convert(sockaddr_in const & from, WiiSockAddrIn& to, s32 addrlen) void WiiSockMan::Convert(sockaddr_in const & from, WiiSockAddrIn& to, s32 addrlen)
{ {
to.addr.addr = from.sin_addr.s_addr; to.addr.addr = from.sin_addr.s_addr;
to.family = from.sin_family; to.family = from.sin_family & 0xFF;
to.port = from.sin_port; to.port = from.sin_port;
if (addrlen < 0 || addrlen > sizeof(WiiSockAddrIn)) if (addrlen < 0 || addrlen > sizeof(WiiSockAddrIn))
to.len = sizeof(WiiSockAddrIn); to.len = sizeof(WiiSockAddrIn);

View File

@ -212,6 +212,11 @@ public:
s32 newSocket(s32 af, s32 type, s32 protocol); s32 newSocket(s32 af, s32 type, s32 protocol);
s32 delSocket(s32 s); s32 delSocket(s32 s);
void clean()
{
WiiSockets.clear();
}
template <typename T> template <typename T>
void doSock(s32 sock, u32 CommandAddress, T type) void doSock(s32 sock, u32 CommandAddress, T type)
{ {