#include "ping.h"
#include "stg/user.h"
-#include "stg/locker.h"
#include "stg/user_property.h"
#include <algorithm>
m_onAddUserConn = users->onAdd([this](auto user){ AddUser(user); });
m_onDelUserConn = users->onDel([this](auto user){ DelUser(user); });
-pinger.SetDelayTime(pingSettings.GetPingDelay());
-pinger.Start();
+m_pinger.SetDelayTime(pingSettings.GetPingDelay());
+m_pinger.Start();
m_thread = std::jthread([this](auto token){ Run(std::move(token)); });
if (!m_thread.joinable())
return 0;
-pinger.Stop();
+m_pinger.Stop();
m_thread.request_stop();
//5 seconds to thread stops itself
struct timespec ts = {0, 200000000};
{
uint32_t ip = (*iter)->GetProperties().ips.ConstData()[0].ip;
time_t t;
- if (pinger.GetIPTime(ip, &t) == 0)
+ if (m_pinger.GetIPTime(ip, t) == 0)
{
if (t != 0)
(*iter)->UpdatePingTime(t);
if (ip != 0)
{
time_t t;
- if (pinger.GetIPTime(ip, &t) == 0)
+ if (m_pinger.GetIPTime(ip, t) == 0)
{
if (t != 0)
(*iter)->UpdatePingTime(t);
SetUserNotifiers(u);
if (u->GetProperties().ips.ConstData().onlyOneIP())
{
- pinger.AddIP(u->GetProperties().ips.ConstData()[0].ip);
+ m_pinger.AddIP(u->GetProperties().ips.ConstData()[0].ip);
}
else
{
uint32_t ip = u->GetCurrIP();
if (ip != 0)
- pinger.AddIP(ip);
+ m_pinger.AddIP(ip);
}
}
//-----------------------------------------------------------------------------
void PING::updateCurrIP(uint32_t oldVal, uint32_t newVal)
{
- pinger.DelIP(oldVal);
+ m_pinger.DelIP(oldVal);
if (newVal != 0)
- pinger.AddIP(newVal);
+ m_pinger.AddIP(newVal);
}
//-----------------------------------------------------------------------------
void PING::updateIPs(const UserIPs& oldVal, const UserIPs& newVal)
{
if (oldVal.onlyOneIP())
- pinger.DelIP(oldVal[0].ip);
+ m_pinger.DelIP(oldVal[0].ip);
if (newVal.onlyOneIP())
- pinger.AddIP(newVal[0].ip);
+ m_pinger.AddIP(newVal[0].ip);
}