From 630e3d6dea9aa327cf3b44c62956da5b842a4963 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Fri, 30 Nov 2018 19:01:05 +0100 Subject: [PATCH] web_service: move telemetry condition from TelemetrySession constructor to destructor Fixes an issue where Testcases couldn't be sent when Telemetry was disabled, because both things are tied closely together in the backend. --- src/core/telemetry_session.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 93e17b268..b6c18cf96 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -93,13 +93,9 @@ bool VerifyLogin(const std::string& username, const std::string& token) { TelemetrySession::TelemetrySession() { #ifdef ENABLE_WEB_SERVICE - if (Settings::values.enable_telemetry) { - backend = std::make_unique(Settings::values.web_api_url, - Settings::values.citra_username, - Settings::values.citra_token); - } else { - backend = std::make_unique(); - } + backend = std::make_unique(Settings::values.web_api_url, + Settings::values.citra_username, + Settings::values.citra_token); #else backend = std::make_unique(); #endif @@ -199,7 +195,8 @@ TelemetrySession::~TelemetrySession() { // This is just a placeholder to wrap up the session once the core completes and this is // destroyed. This will be moved elsewhere once we are actually doing real I/O with the service. field_collection.Accept(*backend); - backend->Complete(); + if (Settings::values.enable_telemetry) + backend->Complete(); backend = nullptr; }