mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
Force close socket in sys_net_bnet_close
This commit is contained in:
parent
000ec71629
commit
58fdf58150
@ -1331,7 +1331,7 @@ lv2_socket::lv2_socket(lv2_socket::socket_type s, s32 s_type, s32 family)
|
|||||||
|
|
||||||
lv2_socket::~lv2_socket()
|
lv2_socket::~lv2_socket()
|
||||||
{
|
{
|
||||||
if (type != SYS_NET_SOCK_DGRAM_P2P && type != SYS_NET_SOCK_STREAM_P2P)
|
if (type != SYS_NET_SOCK_DGRAM_P2P && type != SYS_NET_SOCK_STREAM_P2P && socket)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
::closesocket(socket);
|
::closesocket(socket);
|
||||||
@ -3464,8 +3464,13 @@ error_code sys_net_bnet_close(ppu_thread& ppu, s32 s)
|
|||||||
sys_net.error("CLOSE");
|
sys_net.error("CLOSE");
|
||||||
|
|
||||||
// If it's a bound socket we "close" the vport
|
// If it's a bound socket we "close" the vport
|
||||||
if ((sock->type == SYS_NET_SOCK_DGRAM_P2P || sock->type == SYS_NET_SOCK_STREAM_P2P) && sock->p2p.port && sock->p2p.vport)
|
if (sock->type == SYS_NET_SOCK_DGRAM_P2P || sock->type == SYS_NET_SOCK_STREAM_P2P)
|
||||||
{
|
{
|
||||||
|
if (!sock->p2p.port || !sock->p2p.vport)
|
||||||
|
{
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
auto& nc = g_fxo->get<network_context>();
|
auto& nc = g_fxo->get<network_context>();
|
||||||
{
|
{
|
||||||
std::lock_guard lock(nc.list_p2p_ports_mutex);
|
std::lock_guard lock(nc.list_p2p_ports_mutex);
|
||||||
@ -3493,9 +3498,19 @@ error_code sys_net_bnet_close(ppu_thread& ppu, s32 s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto& dnshook = g_fxo->get<np::dnshook>();
|
||||||
|
dnshook.remove_dns_spy(s);
|
||||||
|
|
||||||
auto& dnshook = g_fxo->get<np::dnshook>();
|
std::lock_guard lock(sock->mutex);
|
||||||
dnshook.remove_dns_spy(s);
|
#ifdef _WIN32
|
||||||
|
::closesocket(sock->socket);
|
||||||
|
#else
|
||||||
|
::close(sock->socket);
|
||||||
|
#endif
|
||||||
|
sock->socket = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user