X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8e80bb9cec2c90dd61f810fb1525932a434288eb..a500fb72810060e52d87ad2c2e4691531f0bcc5a:/projects/stargazer/traffcounter_impl.h diff --git a/projects/stargazer/traffcounter_impl.h b/projects/stargazer/traffcounter_impl.h index 78027cb5..42774bf9 100644 --- a/projects/stargazer/traffcounter_impl.h +++ b/projects/stargazer/traffcounter_impl.h @@ -33,10 +33,13 @@ #include #include #include +#include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#include +#pragma GCC diagnostic pop #include -#include - #define PROTOMAX (5) namespace STG @@ -185,7 +188,7 @@ class TraffCounterImpl : public TraffCounter { void FreeRules(); bool ReadRules(bool test = false); - static void * Run(void * data); + void Run(std::stop_token token); void DeterminateDir(const RawPacket & packet, int * dirU, // Direction for upload @@ -223,10 +226,9 @@ class TraffCounterImpl : public TraffCounter { UsersImpl * users; - bool running; bool stopped; - pthread_mutex_t mutex; - pthread_t thread; + std::mutex m_mutex; + std::jthread m_thread; std::list ipBeforeNotifiers; std::list ipAfterNotifiers;