mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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)
This commit is contained in:
parent
85511a642f
commit
1d8d01074f
3 changed files with 18 additions and 7 deletions
|
@ -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") &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue