Achievements: Use retryable client error status code

This commit is contained in:
Stenzek
2023-11-06 19:49:30 +10:00
parent f62a3ffbfa
commit 3c6b6c5770
5 changed files with 20 additions and 14 deletions

View File

@ -307,7 +307,7 @@ void Achievements::DownloadImage(std::string url, std::string cache_filename)
{
auto callback = [cache_filename](s32 status_code, std::string content_type,
Common::HTTPDownloader::Request::Data data) {
if (status_code != Common::HTTPDownloader::HTTP_OK)
if (status_code != Common::HTTPDownloader::HTTP_STATUS_OK)
return;
if (!FileSystem::WriteBinaryFile(cache_filename.c_str(), data.data(), data.size()))
@ -616,7 +616,10 @@ void Achievements::ClientServerCall(const rc_api_request_t* request, rc_client_s
Common::HTTPDownloader::Request::Callback hd_callback =
[callback, callback_data](s32 status_code, std::string content_type, Common::HTTPDownloader::Request::Data data) {
rc_api_server_response_t rr;
rr.http_status_code = status_code;
rr.http_status_code = (status_code <= 0) ? (status_code == Common::HTTPDownloader::HTTP_STATUS_CANCELLED ?
RC_API_SERVER_RESPONSE_CLIENT_ERROR :
RC_API_SERVER_RESPONSE_RETRYABLE_CLIENT_ERROR) :
status_code;
rr.body_length = data.size();
rr.body = reinterpret_cast<const char*>(data.data());

View File

@ -1169,7 +1169,7 @@ bool GameList::DownloadCovers(const std::vector<std::string>& url_templates, boo
downloader->CreateRequest(
std::move(url), [use_serial, &save_callback, entry_path = std::move(entry_path), filename = std::move(filename)](
s32 status_code, std::string content_type, Common::HTTPDownloader::Request::Data data) {
if (status_code != Common::HTTPDownloader::HTTP_OK || data.empty())
if (status_code != Common::HTTPDownloader::HTTP_STATUS_OK || data.empty())
return;
std::unique_lock lock(s_mutex);