tcp_timeout_monitor deadlock fix (#8783)

This commit is contained in:
RipleyTom 2020-08-28 02:06:01 +02:00 committed by GitHub
parent bd40430d2b
commit 4317291827
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -255,7 +255,7 @@ static void network_clear_queue(ppu_thread& ppu)
// Object in charge of retransmiting packets for STREAM_P2P sockets
class tcp_timeout_monitor
{
public:
public:
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
wakey.wait(lock);
if (abort)
return;
const auto now = std::chrono::system_clock::now();
// Check for messages that haven't been acked
std::set<s32> rtt_increased;
@ -368,11 +371,12 @@ class tcp_timeout_monitor
}
}
public:
public:
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;
// List of outgoing messages
struct message
@ -835,6 +839,7 @@ struct network_thread
WSACleanup();
#endif
auto tcpm = g_fxo->get<named_thread<tcp_timeout_monitor>>();
tcpm->abort = true;
tcpm->wakey.notify_one();
}

View File

@ -52,10 +52,10 @@ rpcn_client::~rpcn_client()
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);
wolfSSL_ERR_error_string(wssl_err, &error_string[0]);
return error_string;
return std::string(error_string);
}
void rpcn_client::disconnect()