]> git.stg.codes - stg.git/commitdiff
Added separate touch time for traffcounter packet processor.
authorMaxim Mamontov <faust.madf@gmail.com>
Tue, 5 Feb 2013 19:22:21 +0000 (21:22 +0200)
committerMaxim Mamontov <faust.madf@gmail.com>
Tue, 5 Feb 2013 19:22:21 +0000 (21:22 +0200)
projects/stargazer/traffcounter_impl.cpp
projects/stargazer/traffcounter_impl.h

index dd2b4395f8f6dd4400d9719843d4782a664ca3a2..17a786ff0a9697f7c9ccc0aa99eb247695950df3 100644 (file)
@@ -68,6 +68,7 @@ TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn)
       rulesFileName(fn),
       monitorDir(),
       monitoring(false),
       rulesFileName(fn),
       monitorDir(),
       monitoring(false),
+      touchTimeP(stgTime - MONITOR_TIME_DELAY_SEC),
       users(u),
       running(false),
       stopped(true),
       users(u),
       running(false),
       stopped(true),
@@ -203,13 +204,11 @@ void TRAFFCOUNTER_IMPL::Process(const RAW_PACKET & rawPacket)
 if (!running)
     return;
 
 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());
     {
     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());
     }
 
     TouchFile(monFile.c_str());
     }
 
index f4049433717972955a618818ecc29768e0ac2970..7e552f82c186e2eab2c179c72ecb2d0d972a43ca 100644 (file)
@@ -241,6 +241,7 @@ private:
 
     std::string              monitorDir;
     bool                     monitoring;
 
     std::string              monitorDir;
     bool                     monitoring;
+    time_t                   touchTimeP;
 
     USERS_IMPL *             users;
 
 
     USERS_IMPL *             users;