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
2 changed files with 11 additions and 6 deletions
+5
View File
@@ -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;
@@ -371,6 +374,7 @@ class tcp_timeout_monitor
public:
std::condition_variable wakey;
static constexpr auto thread_name = "Tcp Over Udp Timeout Manager Thread"sv;
std::atomic<bool> abort = false;
private:
std::mutex data_mutex;
@@ -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();
}
+2 -2
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()