X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/cb062b7ca4e03597c0b25c5a2b6cbc554900fff6..555324cdb34701b2e0fd1d681218de85e5cc7f6d:/projects/stargazer/traffcounter_impl.cpp diff --git a/projects/stargazer/traffcounter_impl.cpp b/projects/stargazer/traffcounter_impl.cpp index 424cc094..ff18a5e2 100644 --- a/projects/stargazer/traffcounter_impl.cpp +++ b/projects/stargazer/traffcounter_impl.cpp @@ -37,6 +37,7 @@ #include #include #include // fopen and similar +#include // strtol #include "stg/common.h" #include "stg/locker.h" @@ -57,7 +58,8 @@ tcp = 0, udp, icmp, tcp_udp, all //----------------------------------------------------------------------------- TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn) - : WriteServLog(GetStgLogger()), + : TRAFFCOUNTER(), + WriteServLog(GetStgLogger()), rulesFileName(fn), monitoring(false), users(u), @@ -98,13 +100,8 @@ if (ReadRules()) printfd(__FILE__, "TRAFFCOUNTER::Start()\n"); int h = users->OpenSearch(); +assert(h && "USERS::OpenSearch is always correct"); USER_IMPL * u; -if (!h) - { - printfd(__FILE__, "TRAFFCOUNTER_IMPL::Start() - Cannot get users\n"); - WriteServLog("TRAFFCOUNTER: Cannot get users."); - return -1; - } while (users->SearchNext(h, &u) == 0) { @@ -130,11 +127,7 @@ if (stopped) running = false; int h = users->OpenSearch(); -if (!h) - { - WriteServLog("TRAFFCOUNTER: Fatal error: Cannot get users."); - return -1; - } +assert(h && "USERS::OpenSearch is always correct"); USER_IMPL * u; while (users->SearchNext(h, &u) == 0)