From 87e8fc50041b3d2fdf47292fe4366e3cdc13cc3e Mon Sep 17 00:00:00 2001 From: Sergey Svistunov Date: Fri, 7 Oct 2022 19:40:34 +0300 Subject: [PATCH] Reset speed info on network error --- KeeneticPlugin.cpp | 7 +++++++ KeeneticPlugin.rc | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/KeeneticPlugin.cpp b/KeeneticPlugin.cpp index b6f12c5..f2aca57 100644 --- a/KeeneticPlugin.cpp +++ b/KeeneticPlugin.cpp @@ -188,6 +188,7 @@ class Worker } void loadData() { + bool success = false; nc_->setUrl(settings_->routerUrl + "/rci/"); std::string s = R"({"show":{"interface":{"rrd":[{"name":"ISP","attribute":"rxspeed","detail":0},{"name":"ISP","attribute":"txspeed","detail":0}]}}})"; @@ -212,6 +213,7 @@ class Worker Json::Value upload = *data3.begin(); uploadSpeed_ = upload["v"].asDouble() / 1000000.0; } + success = true; } } else { @@ -223,6 +225,11 @@ class Worker RmLog(rm_, LOG_ERROR, msg.c_str()); } + + if (!success) { + downloadSpeed_ = 0.0; + uploadSpeed_ = 0.0; + } } }; diff --git a/KeeneticPlugin.rc b/KeeneticPlugin.rc index c68942c..893db9c 100644 --- a/KeeneticPlugin.rc +++ b/KeeneticPlugin.rc @@ -8,7 +8,7 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,3,0 + FILEVERSION 1,0,4,0 PRODUCTVERSION 3,0,2,2161 FILEFLAGSMASK 0x17L #ifdef _DEBUG @@ -24,7 +24,7 @@ BEGIN BEGIN BLOCK "040904E4" BEGIN - VALUE "FileVersion", "1.0.3.0" + VALUE "FileVersion", "1.0.4.0" VALUE "LegalCopyright", "© 2021 - Sergey Svistunov" // Don't change the entries below!