From a536658cf9e66cd5b19c428aa40bcdabf8b5ecd2 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 5 Feb 2013 21:22:21 +0200 Subject: [PATCH 1/1] Added separate touch time for traffcounter packet processor. --- projects/stargazer/traffcounter_impl.cpp | 7 +++---- projects/stargazer/traffcounter_impl.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/stargazer/traffcounter_impl.cpp b/projects/stargazer/traffcounter_impl.cpp index dd2b4395..17a786ff 100644 --- a/projects/stargazer/traffcounter_impl.cpp +++ b/projects/stargazer/traffcounter_impl.cpp @@ -68,6 +68,7 @@ TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn) rulesFileName(fn), monitorDir(), monitoring(false), + touchTimeP(stgTime - MONITOR_TIME_DELAY_SEC), users(u), running(false), stopped(true), @@ -203,13 +204,11 @@ void TRAFFCOUNTER_IMPL::Process(const RAW_PACKET & rawPacket) if (!running) return; -time_t touchTime = stgTime - MONITOR_TIME_DELAY_SEC; - -if (monitoring && (touchTime + MONITOR_TIME_DELAY_SEC <= stgTime)) +if (monitoring && (touchTimeP + MONITOR_TIME_DELAY_SEC <= stgTime)) { std::string monFile = monitorDir + "/traffcounter_p"; printfd(__FILE__, "Monitor=%d file TRAFFCOUNTER %s\n", monitoring, monFile.c_str()); - touchTime = stgTime; + touchTimeP = stgTime; TouchFile(monFile.c_str()); } diff --git a/projects/stargazer/traffcounter_impl.h b/projects/stargazer/traffcounter_impl.h index f4049433..7e552f82 100644 --- a/projects/stargazer/traffcounter_impl.h +++ b/projects/stargazer/traffcounter_impl.h @@ -241,6 +241,7 @@ private: std::string monitorDir; bool monitoring; + time_t touchTimeP; USERS_IMPL * users; -- 2.44.2