diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-08-16 23:48:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 23:48:29 +0200 |
commit | 1d8d01074fdb52946f81110bebf1d001185b394b (patch) | |
tree | 64cbf6f73bc0f18cbf8333247cd71ab1856ed4c2 /src/clientiface.h | |
parent | 85511a642f851100d0d856f4ecbe7fea7a7bb049 (diff) | |
download | minetest-1d8d01074fdb52946f81110bebf1d001185b394b.tar.gz minetest-1d8d01074fdb52946f81110bebf1d001185b394b.tar.bz2 minetest-1d8d01074fdb52946f81110bebf1d001185b394b.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/clientiface.h')
-rw-r--r-- | src/clientiface.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/clientiface.h b/src/clientiface.h index edc389cbb..b19a91b6f 100644 --- a/src/clientiface.h +++ b/src/clientiface.h @@ -427,6 +427,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; } @@ -472,7 +475,6 @@ public: } static std::string state2Name(ClientState state); - protected: //TODO find way to avoid this functions void lock() { m_clients_mutex.lock(); } |