From 7563ca944001d5c8e180fbfa667345a3319c2696 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Tue, 10 Nov 2015 23:22:00 +0100 Subject: [PATCH] Fix deadlock in server manager --- plex/Client/PlexServerManager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plex/Client/PlexServerManager.cpp b/plex/Client/PlexServerManager.cpp index 484232af8..f4930dc5f 100644 --- a/plex/Client/PlexServerManager.cpp +++ b/plex/Client/PlexServerManager.cpp @@ -37,7 +37,7 @@ void CPlexServerReachabilityThread::Process() } /////////////////////////////////////////////////////////////////////////////////////////////////// -CPlexServerManager::CPlexServerManager() : m_stopped(false) +CPlexServerManager::CPlexServerManager() : m_stopped(false), m_reachabilityTestEvent(true) { CPlexConnectionPtr conn; @@ -286,11 +286,15 @@ void CPlexServerManager::UpdateReachability(bool force) p.second->m_server->CancelReachabilityTests(); } + lk.unlock(); + if (!m_reachabilityTestEvent.WaitMSec(10 * 1000)) { CLog::Log(LOGWARNING, "CPlexServerManager::UpdateReachability waited 10 seconds for the reachability stuff to finish, will just move on."); return; } + + lk.lock(); } if (m_reachabilityThreads.size() > 0)