From 8831595e1a5306f4204fedc6ecbc4a3c9299fb35 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 8 Jan 2023 16:12:43 +0000 Subject: Rework how users are assigned to connect classes. - Move core connect class checks and to the core_user module. - Add pre-change and post-change events for when a connect class changes. - Split explicit class changing out into its own method. - Remove the need to almost always call CheckClass after SetClass. - Add use counting to the connect class instead of relying on the shared_ptr use count. --- src/configreader.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index 539901764..65df85bfd 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -152,7 +152,7 @@ void ServerConfig::CrossCheckOperBlocks() void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) { - typedef std::map, ConnectClass::Ptr> ClassMap; + typedef std::map, std::shared_ptr> ClassMap; ClassMap oldBlocksByMask; if (current) { @@ -198,7 +198,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) continue; } - ConnectClass::Ptr parent; + std::shared_ptr parent; std::string parentName = tag->getString("parent"); if (!parentName.empty()) { @@ -250,7 +250,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) ClassMap::iterator oldMask = oldBlocksByMask.find(std::make_pair(mask, me->type)); if (oldMask != oldBlocksByMask.end()) { - ConnectClass::Ptr old = oldMask->second; + std::shared_ptr old = oldMask->second; oldBlocksByMask.erase(oldMask); old->Update(me); me = old; @@ -300,7 +300,6 @@ void ServerConfig::Fill() throw CoreException("You must restart to change the server id"); } SoftLimit = ConfValue("performance")->getUInt("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : LONG_MAX), 10); - CCOnConnect = ConfValue("performance")->getBool("clonesonconnect", true); MaxConn = static_cast(ConfValue("performance")->getUInt("somaxconn", SOMAXCONN)); TimeSkipWarn = ConfValue("performance")->getDuration("timeskipwarn", 2, 0, 30); XLineMessage = options->getString("xlinemessage", "You're banned!", 1); -- cgit v1.3.1-10-gc9f91