Fix STK hanging on shutdown when networking disabled

This commit is contained in:
auria.mg 2018-11-23 19:07:58 -05:00
parent 9d51713300
commit 562fe8a4c8
3 changed files with 16 additions and 4 deletions

View File

@ -2356,11 +2356,14 @@ static void cleanSuperTuxKart()
} }
#endif #endif
if(!Online::RequestManager::get()->waitForReadyToDeleted(5.0f)) if (Online::RequestManager::get()->waitForReadyToDeleted(5.0f))
{ {
Log::info("Thread", "Request Manager not aborting in time, aborting.");
}
Online::RequestManager::deallocate(); Online::RequestManager::deallocate();
}
else
{
Log::warn("Thread", "Request Manager not aborting in time, proceeding without cleanup.");
}
if (!SFXManager::get()->waitForReadyToDeleted(2.0f)) if (!SFXManager::get()->waitForReadyToDeleted(2.0f))
{ {

View File

@ -165,7 +165,8 @@ namespace Online
*/ */
void RequestManager::addRequest(Request *request) void RequestManager::addRequest(Request *request)
{ {
if (UserConfigParams::m_internet_status == RequestManager::IPERM_NOT_ALLOWED) if (UserConfigParams::m_internet_status == RequestManager::IPERM_NOT_ALLOWED
&& request->getType() != Request::RT_QUIT)
{ {
Log::error("RequestManager", "addRequest called, but internet connections are forbidden"); Log::error("RequestManager", "addRequest called, but internet connections are forbidden");
return; return;

View File

@ -156,8 +156,13 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
// If internet is being activated, enable immediately. If it's being disabled, // If internet is being activated, enable immediately. If it's being disabled,
// we'll disable later after logout. // we'll disable later after logout.
if (internet->getState()) if (internet->getState())
{
UserConfigParams::m_internet_status = RequestManager::IPERM_ALLOWED; UserConfigParams::m_internet_status = RequestManager::IPERM_ALLOWED;
if (!RequestManager::isRunning())
RequestManager::get()->startNetworkThread();
}
// If internet gets enabled, re-initialise the addon manager (which // If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be // happens in a separate thread) so that news.xml etc can be
// downloaded if necessary. // downloaded if necessary.
@ -188,7 +193,10 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
// Deactivate internet after 'requestSignOut' so that the sign out request is allowed // Deactivate internet after 'requestSignOut' so that the sign out request is allowed
if (!internet->getState()) if (!internet->getState())
{
UserConfigParams::m_internet_status = RequestManager::IPERM_NOT_ALLOWED; UserConfigParams::m_internet_status = RequestManager::IPERM_NOT_ALLOWED;
RequestManager::get()->stopNetworkThread();
}
} }
else if (name=="enable-hw-report") else if (name=="enable-hw-report")
{ {