X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0907aa4037b12b6b88ee24495d4577a064d4f8db..08dd72f2d8d3d7766e4fa87f01840c3ed8211091:/projects/stargazer/plugins/other/rscript/rscript.h diff --git a/projects/stargazer/plugins/other/rscript/rscript.h b/projects/stargazer/plugins/other/rscript/rscript.h index e734227c..6c97b598 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.h +++ b/projects/stargazer/plugins/other/rscript/rscript.h @@ -36,10 +36,13 @@ #include #include #include +#include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#include +#pragma GCC diagnostic pop #include -#include - namespace STG { struct Settings; @@ -174,7 +177,6 @@ private: class REMOTE_SCRIPT : public STG::Plugin { public: REMOTE_SCRIPT(); - ~REMOTE_SCRIPT() override; void SetUsers(STG::Users * u) override { users = u; } void SetSettings(const STG::ModuleSettings & s) override { settings = s; } @@ -200,7 +202,7 @@ private: REMOTE_SCRIPT(const REMOTE_SCRIPT & rhs); REMOTE_SCRIPT & operator=(const REMOTE_SCRIPT & rhs); - static void * Run(void *); + void Run(std::stop_token token); bool PrepareNet(); bool FinalizeNet(); @@ -215,8 +217,8 @@ private: void SetUserNotifiers(UserPtr u); void UnSetUserNotifiers(UserPtr u); - void InitEncrypt(BLOWFISH_CTX * ctx, const std::string & password) const; - void Encrypt(BLOWFISH_CTX * ctx, void * dst, const void * src, size_t len8) const; + void InitEncrypt(const std::string & password) const; + void Encrypt(void * dst, const void * src, size_t len8) const; mutable BLOWFISH_CTX ctx; @@ -230,15 +232,14 @@ private: int sendPeriod; int halfPeriod; - bool nonstop; bool isRunning; STG::Users * users; std::vector netRouters; - pthread_t thread; - pthread_mutex_t mutex; + std::jthread m_thread; + std::mutex m_mutex; int sock;