PING::PING()
: users(nullptr),
isRunning(false),
- onAddUserNotifier(*this),
- onDelUserNotifier(*this),
logger(STG::PluginLogger::get("ping"))
{
}
{
GetUsers();
-users->AddNotifierUserAdd(&onAddUserNotifier);
-users->AddNotifierUserDel(&onDelUserNotifier);
+m_onAddUserConn = users->onAdd([this](auto user){ AddUser(user); });
+m_onDelUserConn = users->onDel([this](auto user){ DelUser(user); });
pinger.SetDelayTime(pingSettings.GetPingDelay());
pinger.Start();
nanosleep(&ts, nullptr);
}
-users->DelNotifierUserAdd(&onAddUserNotifier);
-users->DelNotifierUserDel(&onDelUserNotifier);
+m_onAddUserConn.disconnect();
+m_onDelUserConn.disconnect();
std::list<UserPtr>::iterator users_iter;
users_iter = usersList.begin();
}
}
//-----------------------------------------------------------------------------
-void CHG_CURRIP_NOTIFIER_PING::Notify(const uint32_t & oldIP, const uint32_t & newIP)
+void CHG_CURRIP_NOTIFIER_PING::notify(const uint32_t & oldIP, const uint32_t & newIP)
{
ping.pinger.DelIP(oldIP);
if (newIP != 0)
ping.pinger.AddIP(newIP);
}
//-----------------------------------------------------------------------------
-void CHG_IPS_NOTIFIER_PING::Notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS)
+void CHG_IPS_NOTIFIER_PING::notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS)
{
if (oldIPS.onlyOneIP())
ping.pinger.DelIP(oldIPS[0].ip);
if (newIPS.onlyOneIP())
ping.pinger.AddIP(newIPS[0].ip);
}
-//-----------------------------------------------------------------------------
-void ADD_USER_NONIFIER_PING::Notify(const UserPtr & user)
-{
-ping.AddUser(user);
-}
-//-----------------------------------------------------------------------------
-void DEL_USER_NONIFIER_PING::Notify(const UserPtr & user)
-{
-ping.DelUser(user);
-}
-//-----------------------------------------------------------------------------