Updated AchievementManager StartRASession to properly lock inputs and outputs without locking during the network call.

This commit is contained in:
LillyJadeKatrin 2023-09-26 21:25:55 -04:00
parent 7153284e9f
commit 6036a6db55
1 changed files with 9 additions and 4 deletions

View File

@ -545,11 +545,16 @@ AchievementManager::ResolveHash(std::array<char, HASH_LENGTH> game_hash)
AchievementManager::ResponseType AchievementManager::StartRASession()
{
rc_api_start_session_request_t start_session_request;
rc_api_start_session_response_t session_data{};
std::string username = Config::Get(Config::RA_USERNAME);
std::string api_token = Config::Get(Config::RA_API_TOKEN);
rc_api_start_session_request_t start_session_request = {
std::string username, api_token;
{
std::lock_guard lg{m_lock};
username = Config::Get(Config::RA_USERNAME);
api_token = Config::Get(Config::RA_API_TOKEN);
start_session_request = {
.username = username.c_str(), .api_token = api_token.c_str(), .game_id = m_game_id};
}
ResponseType r_type = Request<rc_api_start_session_request_t, rc_api_start_session_response_t>(
start_session_request, &session_data, rc_api_init_start_session_request,
rc_api_process_start_session_response);