X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..747017e39d73c3948c988b0d0cf6f1a18e25c4b3:/stglibs/pinger.lib/pinger.cpp diff --git a/stglibs/pinger.lib/pinger.cpp b/stglibs/pinger.lib/pinger.cpp index 9169b4e6..edbcd11e 100644 --- a/stglibs/pinger.lib/pinger.cpp +++ b/stglibs/pinger.lib/pinger.cpp @@ -24,10 +24,15 @@ extern volatile time_t stgTime; //----------------------------------------------------------------------------- STG_PINGER::STG_PINGER(time_t d) + : delay(d), + nonstop(false), + isRunningRecver(false), + isRunningSender(false), + sendSocket(-1), + recvSocket(-1), + pid(0) { - delay = d; pthread_mutex_init(&mutex, NULL); - pid = 0; } //----------------------------------------------------------------------------- STG_PINGER::~STG_PINGER() @@ -172,15 +177,15 @@ void STG_PINGER::RealDelIP() ipToDel.erase(ipToDel.begin(), ipToDel.end()); } //----------------------------------------------------------------------------- -int STG_PINGER::GetPingIPNum() +int STG_PINGER::GetPingIPNum() const { return pingIP.size(); } //----------------------------------------------------------------------------- -void STG_PINGER::GetAllIP(vector *) +/*void STG_PINGER::GetAllIP(vector *) const { //STG_LOCKER lock(&mutex, __FILE__, __LINE__); -} +}*/ //----------------------------------------------------------------------------- void STG_PINGER::PrintAllIP() { @@ -199,10 +204,10 @@ void STG_PINGER::PrintAllIP() } //----------------------------------------------------------------------------- -int STG_PINGER::GetIPTime(uint32_t ip, time_t * t) +int STG_PINGER::GetIPTime(uint32_t ip, time_t * t) const { STG_LOCKER lock(&mutex, __FILE__, __LINE__); - multimap::iterator treeIter; + multimap::const_iterator treeIter; treeIter = pingIP.find(ip); if (treeIter == pingIP.end()) @@ -217,12 +222,12 @@ void STG_PINGER::SetDelayTime(time_t d) delay = d; } //----------------------------------------------------------------------------- -time_t STG_PINGER::GetDelayTime() +time_t STG_PINGER::GetDelayTime() const { return delay; } //----------------------------------------------------------------------------- -string STG_PINGER::GetStrError() +string STG_PINGER::GetStrError() const { return errorStr; } @@ -385,4 +390,3 @@ void * STG_PINGER::RunRecvPing(void * d) return NULL; } //----------------------------------------------------------------------------- -