diff --git a/include/ZeusBaseClass.h b/include/ZeusBaseClass.h index 6a4623916..c6115763a 100644 --- a/include/ZeusBaseClass.h +++ b/include/ZeusBaseClass.h @@ -79,7 +79,7 @@ class User { class LocalUser : public User { public: LocalUser() : User(config->Getvalue("serverName")), mLang(config->Getvalue("language")) {}; - virtual ~LocalUser() { }; + virtual ~LocalUser() { threads.clear(); }; static LocalUser *FindLocalUser(std::string nick); void Parse(std::string message); void CheckPing(); @@ -124,6 +124,8 @@ class LocalUser : public User { std::string PassWord; std::string mLang; std::mutex mtx; + + std::vector threads; }; class PlainUser : public LocalUser, public std::enable_shared_from_this { diff --git a/include/sqlite.h b/include/sqlite.h index e927707d5..6246afe18 100644 --- a/include/sqlite.h +++ b/include/sqlite.h @@ -234,9 +234,9 @@ namespace sqlite this->_filename = filename; int rc; if (readonly == true) - rc = sqlite3_open_v2(filename.c_str(), &this->_db, SQLITE_OPEN_READONLY | SQLITE_OPEN_FULLMUTEX, NULL); + rc = sqlite3_open_v2(filename.c_str(), &this->_db, SQLITE_OPEN_READONLY, NULL); else - rc = sqlite3_open_v2(filename.c_str(), &this->_db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX, NULL); + rc = sqlite3_open_v2(filename.c_str(), &this->_db, SQLITE_OPEN_READWRITE, NULL); if(rc != SQLITE_OK) { exception e("Could not open '" + filename + "'"); diff --git a/src/PlainUser.cpp b/src/PlainUser.cpp index b6fcd30a9..9d58dd5bb 100644 --- a/src/PlainUser.cpp +++ b/src/PlainUser.cpp @@ -122,9 +122,10 @@ void PlainUser::handleRead(const boost::system::error_code& error, std::size_t b message.erase(boost::remove_if(message, boost::is_any_of("\r\n")), message.end()); - std::thread t(boost::bind(&PlainUser::Parse, shared_from_this(), message)); - t.join(); - + std::thread t = std::thread(boost::bind(&PlainUser::Parse, shared_from_this(), message)); + t.detach(); + threads.push_back(std::move(t)); + read(); } else Exit(); diff --git a/src/SSLUser.cpp b/src/SSLUser.cpp index 5b0185f21..67401d6d3 100644 --- a/src/SSLUser.cpp +++ b/src/SSLUser.cpp @@ -123,8 +123,9 @@ void LocalSSLUser::handleRead(const boost::system::error_code& error, std::size_ message.erase(boost::remove_if(message, boost::is_any_of("\r\n")), message.end()); - std::thread t(boost::bind(&LocalSSLUser::Parse, shared_from_this(), message)); - t.join(); + std::thread t = std::thread(boost::bind(&LocalSSLUser::Parse, shared_from_this(), message)); + t.detach(); + threads.push_back(std::move(t)); read(); } else diff --git a/src/WebUser.cpp b/src/WebUser.cpp index 0f5a05486..3784a5111 100644 --- a/src/WebUser.cpp +++ b/src/WebUser.cpp @@ -117,8 +117,9 @@ void LocalWebUser::handleRead(const boost::system::error_code &error, std::size_ message.erase(boost::remove_if(message, boost::is_any_of("\r\n")), message.end()); - std::thread t(boost::bind(&LocalWebUser::Parse, shared_from_this(), message)); - t.join(); + std::thread t = std::thread(boost::bind(&LocalWebUser::Parse, shared_from_this(), message)); + t.detach(); + threads.push_back(std::move(t)); read(); } else diff --git a/src/ZeusBaseClass.cpp b/src/ZeusBaseClass.cpp index 2bad638c4..189dde6ef 100644 --- a/src/ZeusBaseClass.cpp +++ b/src/ZeusBaseClass.cpp @@ -225,15 +225,15 @@ void ClientServer::handleAccept(const std::shared_ptr newclient, cons if (stoi(config->Getvalue("maxUsers")) <= Mainframe::instance()->countusers()) { newclient->SendAsServer("465 ZeusiRCd :" + Utils::make_string("", "The server has reached maximum number of connections.")); newclient->Close(); - } else if (Server::CheckClone(newclient->ip()) == true) { - newclient->SendAsServer("465 ZeusiRCd :" + Utils::make_string("", "You have reached the maximum number of clones.")); - newclient->Close(); +// } else if (Server::CheckClone(newclient->ip()) == true) { +// newclient->SendAsServer("465 ZeusiRCd :" + Utils::make_string("", "You have reached the maximum number of clones.")); +// newclient->Close(); } else if (Server::CheckDNSBL(newclient->ip()) == true) { newclient->SendAsServer("465 ZeusiRCd :" + Utils::make_string("", "Your IP is in our DNSBL lists.")); newclient->Close(); - } else if (Server::CheckThrottle(newclient->ip()) == true) { - newclient->SendAsServer("465 ZeusiRCd :" + Utils::make_string("", "You connect too fast, wait 30 seconds to try connect again.")); - newclient->Close(); +// } else if (Server::CheckThrottle(newclient->ip()) == true) { +// newclient->SendAsServer("465 ZeusiRCd :" + Utils::make_string("", "You connect too fast, wait 30 seconds to try connect again.")); +// newclient->Close(); } else if (OperServ::IsGlined(newclient->ip()) == true) { newclient->SendAsServer("465 ZeusiRCd :" + Utils::make_string("", "You are G-Lined. Reason: %s", OperServ::ReasonGlined(newclient->ip()).c_str())); newclient->Close();