X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0907aa4037b12b6b88ee24495d4577a064d4f8db..2741145e6eb219cb0ccb75e729b86f8fc2b499bb:/projects/stargazer/users_impl.h?ds=inline 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;