X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8e80bb9cec2c90dd61f810fb1525932a434288eb..1cb912e4f90473f78d2f0f10ab5c9b2c5bd36440:/projects/stargazer/plugins/capture/pcap/pcap_cap.h?ds=inline diff --git a/projects/stargazer/plugins/capture/pcap/pcap_cap.h b/projects/stargazer/plugins/capture/pcap/pcap_cap.h index f47c6b8d..24d7f253 100644 --- a/projects/stargazer/plugins/capture/pcap/pcap_cap.h +++ b/projects/stargazer/plugins/capture/pcap/pcap_cap.h @@ -26,16 +26,19 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#include +#pragma GCC diagnostic pop #include -#include #include namespace STG { -struct Users; -struct Tariffs; +class Users; +class Tariffs; struct Admins; struct TraffCounter; struct Settings; @@ -45,7 +48,7 @@ struct Settings; struct DEV { DEV() : device("any"), filterExpression("ip"), handle(NULL), fd(-1) {} - DEV(const std::string & d) : device(d), filterExpression("ip"), handle(NULL), fd(-1) {} + explicit DEV(const std::string & d) : device(d), filterExpression("ip"), handle(NULL), fd(-1) {} DEV(const std::string & d, const std::string & f) : device(d), filterExpression(f), handle(NULL), fd(-1) {} @@ -84,12 +87,11 @@ private: void TryRead(const fd_set & set); void TryReadDev(const DEV & dev); - static void * Run(void *); + void Run(std::stop_token token); mutable std::string errorStr; - pthread_t thread; - bool nonstop; + std::jthread m_thread; bool isRunning; STG::ModuleSettings settings; DEV_MAP devices;