Achievements: Fix crash in WinHTTP timeout

Co-authored-by: salas-dev-max <dren@thePuter.localdomain>
This commit is contained in:
Tyandsalas-dev-max authored and Ty committed 2026-05-13 12:20:43 -04:00
1 parent 469a3d60b2
commit 3233a3cf8f
2 files changed
+22 -7

No files matched your search

+11 -3
View File
@@ -56,6 +56,11 @@ bool HTTPDownloaderWinHttp::Initialize(std::string user_agent)
return false;
}
DWORD timeout_ms = 15000;
WinHttpSetOption(m_hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeout_ms, sizeof(timeout_ms));
WinHttpSetOption(m_hSession, WINHTTP_OPTION_SEND_TIMEOUT, &timeout_ms, sizeof(timeout_ms));
WinHttpSetOption(m_hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeout_ms, sizeof(timeout_ms));
return true;
}
@@ -290,10 +295,13 @@ bool HTTPDownloaderWinHttp::StartRequest(HTTPDownloader::Request* request)
req->status_code = HTTP_STATUS_ERROR;
req->state.store(Request::State::Complete);
}
else
{
DevCon.WriteLn("Started HTTP request for '%s'", req->url.c_str());
req->state = Request::State::Started;
req->start_time = Common::Timer::GetCurrentValue();
}
DevCon.WriteLn("Started HTTP request for '%s'", req->url.c_str());
req->state = Request::State::Started;
req->start_time = Common::Timer::GetCurrentValue();
return true;
}