summaryrefslogtreecommitdiffstats
path: root/src/web_service/web_backend.cpp
diff options
context:
space:
mode:
authorWeiyi Wang <wwylele@gmail.com>2018-09-17 20:28:58 +0200
committerfearlessTobi <thm.frey@gmail.com>2018-10-02 15:30:48 +0200
commit62f9409ba3e114b40b6923808290c02bf5af3d2c (patch)
treeb628db116034f811d0b55b8d8384bd704f80aa18 /src/web_service/web_backend.cpp
parentAddress more review comments (diff)
downloadyuzu-62f9409ba3e114b40b6923808290c02bf5af3d2c.tar
yuzu-62f9409ba3e114b40b6923808290c02bf5af3d2c.tar.gz
yuzu-62f9409ba3e114b40b6923808290c02bf5af3d2c.tar.bz2
yuzu-62f9409ba3e114b40b6923808290c02bf5af3d2c.tar.lz
yuzu-62f9409ba3e114b40b6923808290c02bf5af3d2c.tar.xz
yuzu-62f9409ba3e114b40b6923808290c02bf5af3d2c.tar.zst
yuzu-62f9409ba3e114b40b6923808290c02bf5af3d2c.zip
Diffstat (limited to 'src/web_service/web_backend.cpp')
-rw-r--r--src/web_service/web_backend.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp
index 3a3f44dc2..5df4df5eb 100644
--- a/src/web_service/web_backend.cpp
+++ b/src/web_service/web_backend.cpp
@@ -24,6 +24,7 @@ Client::JWTCache Client::jwt_cache{};
Client::Client(const std::string& host, const std::string& username, const std::string& token)
: host(host), username(username), token(token) {
+ std::lock_guard<std::mutex> lock(jwt_cache.mutex);
if (username == jwt_cache.username && token == jwt_cache.token) {
jwt = jwt_cache.jwt;
}
@@ -116,6 +117,7 @@ void Client::UpdateJWT() {
if (result.result_code != Common::WebResult::Code::Success) {
LOG_ERROR(WebService, "UpdateJWT failed");
} else {
+ std::lock_guard<std::mutex> lock(jwt_cache.mutex);
jwt_cache.username = username;
jwt_cache.token = token;
jwt_cache.jwt = jwt = result.returned_data;