X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8e80bb9cec2c90dd61f810fb1525932a434288eb..be1b46cc784e43cd28c5521bdcde79bd7463fb40:/projects/stargazer/users_impl.h diff --git a/projects/stargazer/users_impl.h b/projects/stargazer/users_impl.h index ef5ee0ec..bfb52fa1 100644 --- a/projects/stargazer/users_impl.h +++ b/projects/stargazer/users_impl.h @@ -26,6 +26,11 @@ #include #include #include +#include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#include +#pragma GCC diagnostic pop #include #include @@ -71,7 +76,6 @@ public: UsersImpl(SettingsImpl * s, Store * store, Tariffs * tariffs, Services & svcs, const Admin& sysAdmin); - virtual ~UsersImpl(); int FindByName(const std::string & login, UserPtr * user) override; int FindByName(const std::string & login, ConstUserPtr * user) const override; @@ -108,7 +112,7 @@ public: bool IsIPInIndex(uint32_t ip) const override; bool IsIPInUse(uint32_t ip, const std::string & login, ConstUserPtr * user) const override; - int OpenSearch() override; + unsigned int OpenSearch() override; int SearchNext(int handler, UserPtr * user) override; int SearchNext(int handler, UserImpl ** user); int CloseSearch(int handler) override; @@ -124,8 +128,8 @@ private: void DelFromIPIdx(uint32_t ip); bool FindByIPIdx(uint32_t ip, user_iter & iter) const; - int FindByNameNonLock(const std::string & login, user_iter * user); - int FindByNameNonLock(const std::string & login, const_user_iter * user) const; + bool FindByNameNonLock(const std::string & login, user_iter * user); + bool FindByNameNonLock(const std::string & login, const_user_iter * user) const; void RealDelUser(); void ProcessActions(); @@ -133,7 +137,7 @@ private: void AddUserIntoIndexes(user_iter user); void DelUserFromIndexes(user_iter user); - static void * Run(void *); + void Run(std::stop_token token); void NewMinute(const struct tm & t); void NewDay(const struct tm & t); void DayResetTraff(const struct tm & t); @@ -147,20 +151,19 @@ private: std::map loginIndex; SettingsImpl * settings; - Tariffs * tariffs; + Tariffs * m_tariffs; Services & m_services; - Store * store; - const Admin& sysAdmin; + Store * m_store; + const Admin& m_sysAdmin; Logger & WriteServLog; - bool nonstop; bool isRunning; - mutable pthread_mutex_t mutex; - pthread_t thread; + mutable std::mutex m_mutex; + std::jthread m_thread; mutable unsigned int handle; - mutable std::map searchDescriptors; + mutable std::map searchDescriptors; std::set*> onAddNotifiers; std::set*> onDelNotifiers;