Add another thread in NetworkClient for handling ProfileManager requests outside of the main listener thread, to avoid deadlocking the waiting receivers

This commit is contained in:
Adam Honse
2026-05-17 15:01:54 -05:00
parent a69390e5a8
commit c11090a4cf
3 changed files with 120 additions and 16 deletions

View File

@@ -563,6 +563,19 @@ void NetworkServer::StopServer()
socket_count = 0;
/*-----------------------------------------------------*\
| Close the ProfileManager listen thread |
\*-----------------------------------------------------*/
if(profilemanager_thread->thread)
{
profilemanager_thread->online = false;
profilemanager_thread->start_cv.notify_all();
profilemanager_thread->thread->join();
delete profilemanager_thread->thread;
profilemanager_thread->thread = nullptr;
delete profilemanager_thread;
}
/*-----------------------------------------------------*\
| Client info has changed, call the callbacks |
\*-----------------------------------------------------*/
@@ -1066,7 +1079,7 @@ void NetworkServer::ControllerListenThread(NetworkServerControllerThread* this_t
void NetworkServer::ProfileManagerListenThread(NetworkServerControllerThread* this_thread)
{
while(this_thread->online == true)
while(this_thread->online == true)
{
std::unique_lock<std::mutex> start_lock(this_thread->start_mutex);
this_thread->start_cv.wait(start_lock);