From 49b3da7cf50a76023eda825d66cbc736aa2f1d12 Mon Sep 17 00:00:00 2001 From: Florian Zia Date: Wed, 16 Nov 2022 18:17:53 +0100 Subject: [PATCH] Set upload benchmark endpoints (#4947) * chore: Add endpoints for upload benchmark * fix: Do not add up transferred bytes for upload benchmark --- src/connectionbenchmark/benchmarktasktransfer.cpp | 4 +++- src/connectionbenchmark/connectionbenchmark.h | 2 +- src/constants.h | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/connectionbenchmark/benchmarktasktransfer.cpp b/src/connectionbenchmark/benchmarktasktransfer.cpp index 05063cff5..6bc915852 100644 --- a/src/connectionbenchmark/benchmarktasktransfer.cpp +++ b/src/connectionbenchmark/benchmarktasktransfer.cpp @@ -204,7 +204,9 @@ void BenchmarkTaskTransfer::transferProgressed(qint64 bytesSent, } case BenchmarkUpload: { Q_UNUSED(reply); - m_bytesTransferred += bytesSent; + if (bytesSent > 0) { + m_bytesTransferred = bytesSent; + } break; } default: { diff --git a/src/connectionbenchmark/connectionbenchmark.h b/src/connectionbenchmark/connectionbenchmark.h index 0412f609a..308295439 100644 --- a/src/connectionbenchmark/connectionbenchmark.h +++ b/src/connectionbenchmark/connectionbenchmark.h @@ -92,7 +92,7 @@ class ConnectionBenchmark final : public QObject { private: QUrl m_downloadUrl = QUrl(Constants::BENCHMARK_DOWNLOAD_URL); - QUrl m_uploadUrl = QUrl(Constants::BENCHMARK_UPLOAD_URL); + QUrl m_uploadUrl = QUrl(Constants::benchmarkUploadUrl()); QList m_benchmarkTasks; diff --git a/src/constants.h b/src/constants.h index 48125cd34..7e5bfa1b0 100644 --- a/src/constants.h +++ b/src/constants.h @@ -49,8 +49,6 @@ constexpr uint32_t BENCHMARK_THRESHOLD_SPEED_FAST = 25000000; // 25 Megabit constexpr uint32_t BENCHMARK_THRESHOLD_SPEED_MEDIUM = 10000000; // 10 Megabit constexpr const char* BENCHMARK_DOWNLOAD_URL = "https://archive.mozilla.org/pub/vpn/speedtest/50m.data"; -// TODO: Add url for upload benchmark -constexpr const char* BENCHMARK_UPLOAD_URL = ""; #if defined(UNIT_TEST) # define CONSTEXPR(type, functionName, releaseValue, debugValue, \ @@ -115,6 +113,10 @@ constexpr const char* GOOGLE_SUBSCRIPTIONS_URL = constexpr const char* ADDON_SETTINGS_GROUP = "addons"; +PRODBETAEXPR( + const char*, benchmarkUploadUrl, "https://benchmark.vpn.mozilla.org/upload", + "https://dev.vpn-network-benchmark.nonprod.webservices.mozgcp.net/upload"); + PRODBETAEXPR(QString, fxaApiBaseUrl, "https://api.accounts.firefox.com", envOrDefault("MVPN_FXA_API_BASE_URL", "https://api-accounts.stage.mozaws.net"))