]> git.stg.codes - stg.git/blobdiff - projects/stargazer/traffcounter_impl.cpp
Added COMMAND_FUNCTOR and COMMAND_ACTION.
[stg.git] / projects / stargazer / traffcounter_impl.cpp
index 6f16be9aa2ac48013ae533d163f6314349f71df2..fce475952537b598d5f39864d6975fe863d3be67 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "stg/common.h"
 #include "stg/locker.h"
 
 #include "stg/common.h"
 #include "stg/locker.h"
+#include "stg/const.h" // MONITOR_TIME_DELAY_SEC
 #include "traffcounter_impl.h"
 #include "stg_timer.h"
 #include "users_impl.h"
 #include "traffcounter_impl.h"
 #include "stg_timer.h"
 #include "users_impl.h"
@@ -67,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),
@@ -202,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());
     }
 
@@ -738,8 +738,8 @@ if (ReadRules(true))
 
 FreeRules();
 ReadRules();
 
 FreeRules();
 ReadRules();
-printfd(__FILE__, "TRAFFCOUNTER_IMPL::Reload() -  Reload rules successfull.\n");
-WriteServLog("TRAFFCOUNTER: Reload rules successfull.");
+printfd(__FILE__, "TRAFFCOUNTER_IMPL::Reload() -  Reloaded rules successfully.\n");
+WriteServLog("TRAFFCOUNTER: Reloaded rules successfully.");
 return 0;
 }
 //-----------------------------------------------------------------------------
 return 0;
 }
 //-----------------------------------------------------------------------------