Merge pull request #1887 from FearlessTobi/port-4476

Port citra-emu/citra#4476: "web_service: move telemetry condition from TelemetrySession constructor to destructor"
merge-requests/60/head
bunnei 2018-12-10 21:47:22 +07:00 committed by GitHub
commit 9eb9b344c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

@ -103,13 +103,8 @@ 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<WebService::TelemetryJson>(Settings::values.web_api_url,
Settings::values.yuzu_username,
Settings::values.yuzu_token);
} else {
backend = std::make_unique<Telemetry::NullVisitor>();
}
backend = std::make_unique<WebService::TelemetryJson>(
Settings::values.web_api_url, Settings::values.yuzu_username, Settings::values.yuzu_token);
#else
backend = std::make_unique<Telemetry::NullVisitor>();
#endif
@ -180,7 +175,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;
}