X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0907aa4037b12b6b88ee24495d4577a064d4f8db..1cb912e4f90473f78d2f0f10ab5c9b2c5bd36440:/projects/stargazer/plugins/capture/pcap/pcap_cap.h 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;