diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-08-16 23:48:29 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:31:59 +0200 |
commit | 151c19a6be591d19d83cdd3c69583e7bf0828440 (patch) | |
tree | 37470c00d6cb1472aff14cb86fe3bf53c13d7439 /src/network | |
parent | 9d40d89d2721359b02c578366ebfd0ef1b91116d (diff) | |
download | minetest-151c19a6be591d19d83cdd3c69583e7bf0828440.tar.gz minetest-151c19a6be591d19d83cdd3c69583e7bf0828440.tar.bz2 minetest-151c19a6be591d19d83cdd3c69583e7bf0828440.zip |
ClientInterface: add a function to verify (correctly) if user limit was reached (#6258)
* ClientInterface: add a function to verify (correctly) if user limit was reached
CS_HelloSent is a better indicator of active slots than CS_Created, which are session objects created after init packet reception
Switch existing checks to ClientInterface::isUserLimitReached()
Use range-based for loop for getClientIds() used function too
This will fix #6254 (not the memory overhead if init is flooded)
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/serverpackethandler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 5b026bbdb..22456f487 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -211,7 +211,7 @@ void Server::handleCommand_Init(NetworkPacket* pkt) // Enforce user limit. // Don't enforce for users that have some admin right - if (m_clients.getClientIDs(CS_Created).size() >= g_settings->getU16("max_users") && + if (m_clients.isUserLimitReached() && !checkPriv(playername, "server") && !checkPriv(playername, "ban") && !checkPriv(playername, "privs") && @@ -520,7 +520,7 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt) // Enforce user limit. // Don't enforce for users that have some admin right - if (m_clients.getClientIDs(CS_Created).size() >= g_settings->getU16("max_users") && + if (m_clients.isUserLimitReached() >= g_settings->getU16("max_users") && !checkPriv(playername, "server") && !checkPriv(playername, "ban") && !checkPriv(playername, "privs") && |