From d2634d1321e02fcb020ff1f7ef17918149b1432b Mon Sep 17 00:00:00 2001 From: Nova Date: Sun, 24 Aug 2025 16:35:13 +0330 Subject: [PATCH] fix looping functions --- include/stats/connections/connectionLister.hpp | 4 ---- src/stats/connectionLister/connectionLister.cpp | 7 +------ src/stats/traffic/TrafficLooper.cpp | 1 + 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/include/stats/connections/connectionLister.hpp b/include/stats/connections/connectionLister.hpp index c4982e2..f99afba 100644 --- a/include/stats/connections/connectionLister.hpp +++ b/include/stats/connections/connectionLister.hpp @@ -43,8 +43,6 @@ namespace Stats void ForceUpdate(); - void stopLoop(); - void setSort(ConnectionSort newSort); private: @@ -52,8 +50,6 @@ namespace Stats QMutex mu; - bool stop = false; - std::shared_ptr> state; ConnectionSort sort = Default; diff --git a/src/stats/connectionLister/connectionLister.cpp b/src/stats/connectionLister/connectionLister.cpp index 3e8f825..dd66dfc 100644 --- a/src/stats/connectionLister/connectionLister.cpp +++ b/src/stats/connectionLister/connectionLister.cpp @@ -25,7 +25,7 @@ namespace Stats { while (true) { - if (stop) return; + if (Configs::dataStore->prepare_exit) return; QThread::msleep(1000); if (suspend || !Configs::dataStore->enable_stats) continue; @@ -137,11 +137,6 @@ namespace Stats } } - void ConnectionLister::stopLoop() - { - stop = true; - } - void ConnectionLister::setSort(const ConnectionSort newSort) { if (newSort == ByTraffic) diff --git a/src/stats/traffic/TrafficLooper.cpp b/src/stats/traffic/TrafficLooper.cpp index 3f53c67..9e84d2c 100644 --- a/src/stats/traffic/TrafficLooper.cpp +++ b/src/stats/traffic/TrafficLooper.cpp @@ -67,6 +67,7 @@ namespace Stats { void TrafficLooper::Loop() { elapsedTimer.start(); while (true) { + if (Configs::dataStore->prepare_exit) return; QThread::msleep(1000); // refresh every one second if (Configs::dataStore->disable_traffic_stats) {