traffic counters initialization at start moment
parent
c95d2518e0
commit
de9bb0a551
|
@ -19,6 +19,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
|
||||
#include "proxyinstanse.h"
|
||||
#include "httpserver.h"
|
||||
#include "statistics.h"
|
||||
#include "dbmanager.h"
|
||||
#include "g.h"
|
||||
|
||||
|
@ -206,6 +207,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
DBManager().initAtStart();
|
||||
Statistics::initTrafficCounters();
|
||||
|
||||
for (const auto& pair: instanses)
|
||||
{
|
||||
|
|
|
@ -102,6 +102,15 @@ const TopDestinationList Statistics::totalTopDestinations()
|
|||
return m_totalTopDestinations;
|
||||
}
|
||||
|
||||
void Statistics::initTrafficCounters()
|
||||
{
|
||||
DBManager db;
|
||||
m_dailyDownload = db.dailyDownloadTraffic();
|
||||
m_dailyUpload = db.dailyUploadTraffic();
|
||||
m_totalDownload = db.totalDownloadTraffic();
|
||||
m_totalUpload = db.totalUploadTraffic();
|
||||
}
|
||||
|
||||
void Statistics::actualizeTopLists()
|
||||
{
|
||||
QMutexLocker lock (&m_topDestinationsMtx);
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
static const TopDestinationList dailyTopDestinations();
|
||||
static const TopDestinationList totalTopDestinations();
|
||||
|
||||
static void initTrafficCounters();
|
||||
static quint64 dailyUpload() { return m_dailyUpload; }
|
||||
static quint64 totalUpload() { return m_totalUpload; }
|
||||
static quint64 dailyDownload() { return m_dailyDownload; }
|
||||
|
|
Loading…
Reference in New Issue