1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-27 22:05:17 +01: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:
Loïc Blot
2017-08-16 23:48:29 +02:00
committed by SmallJoker
parent 9d40d89d27
commit 151c19a6be
3 changed files with 15 additions and 3 deletions

View File

@@ -449,6 +449,9 @@ public:
/* get list of active client id's */
std::vector<u16> getClientIDs(ClientState min_state=CS_Active);
/* verify is server user limit was reached */
bool isUserLimitReached();
/* get list of client player names */
const std::vector<std::string> &getPlayerNames() const { return m_clients_names; }
@@ -493,7 +496,6 @@ public:
}
static std::string state2Name(ClientState state);
protected:
//TODO find way to avoid this functions
void lock() { m_clients_mutex.lock(); }