]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/ping/ping.cpp
Merge remote-tracking branch 'github/master'
[stg.git] / projects / stargazer / plugins / other / ping / ping.cpp
index db081f7e5af12ab75b50dbeb1ca1f4b03a7d5a2a..892331f69d57b247ee33f519fab6eae7110604a5 100644 (file)
@@ -1,7 +1,6 @@
 #include "ping.h"
 
 #include "stg/user.h"
 #include "ping.h"
 
 #include "stg/user.h"
-#include "stg/locker.h"
 #include "stg/user_property.h"
 
 #include <algorithm>
 #include "stg/user_property.h"
 
 #include <algorithm>
@@ -71,8 +70,8 @@ GetUsers();
 m_onAddUserConn = users->onAdd([this](auto user){ AddUser(user); });
 m_onDelUserConn = users->onDel([this](auto user){ DelUser(user); });
 
 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)); });
 
 
 m_thread = std::jthread([this](auto token){ Run(std::move(token)); });
 
@@ -86,7 +85,7 @@ std::lock_guard lock(m_mutex);
 if (!m_thread.joinable())
     return 0;
 
 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};
 m_thread.request_stop();
 //5 seconds to thread stops itself
 struct timespec ts = {0, 200000000};
@@ -137,7 +136,7 @@ while (!token.stop_requested())
                 {
                 uint32_t ip = (*iter)->GetProperties().ips.ConstData()[0].ip;
                 time_t t;
                 {
                 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 (t != 0)
                         (*iter)->UpdatePingTime(t);
@@ -149,7 +148,7 @@ while (!token.stop_requested())
                 if (ip != 0)
                     {
                     time_t 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);
                         {
                         if (t != 0)
                             (*iter)->UpdatePingTime(t);
@@ -202,13 +201,13 @@ while (users->SearchNext(h, &u) == 0)
     SetUserNotifiers(u);
     if (u->GetProperties().ips.ConstData().onlyOneIP())
         {
     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)
         }
     else
         {
         uint32_t ip = u->GetCurrIP();
         if (ip != 0)
-            pinger.AddIP(ip);
+            m_pinger.AddIP(ip);
         }
     }
 
         }
     }
 
@@ -245,16 +244,16 @@ while (users_iter != usersList.end())
 //-----------------------------------------------------------------------------
 void PING::updateCurrIP(uint32_t oldVal, uint32_t newVal)
 {
 //-----------------------------------------------------------------------------
 void PING::updateCurrIP(uint32_t oldVal, uint32_t newVal)
 {
-    pinger.DelIP(oldVal);
+    m_pinger.DelIP(oldVal);
     if (newVal != 0)
     if (newVal != 0)
-        pinger.AddIP(newVal);
+        m_pinger.AddIP(newVal);
 }
 //-----------------------------------------------------------------------------
 void PING::updateIPs(const UserIPs& oldVal, const UserIPs& newVal)
 {
     if (oldVal.onlyOneIP())
 }
 //-----------------------------------------------------------------------------
 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())
 
     if (newVal.onlyOneIP())
-        pinger.AddIP(newVal[0].ip);
+        m_pinger.AddIP(newVal[0].ip);
 }
 }