tcp_timeout_monitor deadlock fix (#8783)
This commit is contained in:
@@ -255,7 +255,7 @@ static void network_clear_queue(ppu_thread& ppu)
|
|||||||
// Object in charge of retransmiting packets for STREAM_P2P sockets
|
// Object in charge of retransmiting packets for STREAM_P2P sockets
|
||||||
class tcp_timeout_monitor
|
class tcp_timeout_monitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void add_message(s32 sock_id, const sockaddr_in *dst, std::vector<u8> data, u64 seq)
|
void add_message(s32 sock_id, const sockaddr_in *dst, std::vector<u8> data, u64 seq)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -306,6 +306,9 @@ class tcp_timeout_monitor
|
|||||||
else
|
else
|
||||||
wakey.wait(lock);
|
wakey.wait(lock);
|
||||||
|
|
||||||
|
if (abort)
|
||||||
|
return;
|
||||||
|
|
||||||
const auto now = std::chrono::system_clock::now();
|
const auto now = std::chrono::system_clock::now();
|
||||||
// Check for messages that haven't been acked
|
// Check for messages that haven't been acked
|
||||||
std::set<s32> rtt_increased;
|
std::set<s32> rtt_increased;
|
||||||
@@ -368,11 +371,12 @@ class tcp_timeout_monitor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::condition_variable wakey;
|
std::condition_variable wakey;
|
||||||
static constexpr auto thread_name = "Tcp Over Udp Timeout Manager Thread"sv;
|
static constexpr auto thread_name = "Tcp Over Udp Timeout Manager Thread"sv;
|
||||||
|
std::atomic<bool> abort = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex data_mutex;
|
std::mutex data_mutex;
|
||||||
// List of outgoing messages
|
// List of outgoing messages
|
||||||
struct message
|
struct message
|
||||||
@@ -835,6 +839,7 @@ struct network_thread
|
|||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
auto tcpm = g_fxo->get<named_thread<tcp_timeout_monitor>>();
|
auto tcpm = g_fxo->get<named_thread<tcp_timeout_monitor>>();
|
||||||
|
tcpm->abort = true;
|
||||||
tcpm->wakey.notify_one();
|
tcpm->wakey.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ rpcn_client::~rpcn_client()
|
|||||||
|
|
||||||
std::string rpcn_client::get_wolfssl_error(int error)
|
std::string rpcn_client::get_wolfssl_error(int error)
|
||||||
{
|
{
|
||||||
std::string error_string(80, '\0');
|
char error_string[80]{};
|
||||||
auto wssl_err = wolfSSL_get_error(wssl, error);
|
auto wssl_err = wolfSSL_get_error(wssl, error);
|
||||||
wolfSSL_ERR_error_string(wssl_err, &error_string[0]);
|
wolfSSL_ERR_error_string(wssl_err, &error_string[0]);
|
||||||
return error_string;
|
return std::string(error_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpcn_client::disconnect()
|
void rpcn_client::disconnect()
|
||||||
|
|||||||
Reference in New Issue
Block a user