Some minor code refactors and fixed converter for 332bit builds

This commit is contained in:
WolverinDEV
2021-02-05 14:20:11 +01:00
parent 9af0a76ed6
commit 9a523f1525
11 changed files with 42 additions and 27 deletions
+14 -6
View File
@@ -100,18 +100,26 @@ command_result SpeakingClient::handleCommandClientInit(Command& cmd) {
{
lock_guard<threads::Mutex> lock(this->server->join_attempts_lock);
auto inetAddr = this->getPeerIp();
if(config::voice::clientConnectLimit > 0 && this->server->join_attempts[inetAddr] + 1 > config::voice::clientConnectLimit)
auto client_address = this->getPeerIp();
auto& client_join_attempts = this->server->join_attempts[client_address];
auto& general_join_attempts = this->server->join_attempts["_"];
if(config::voice::clientConnectLimit > 0 && client_join_attempts + 1 > config::voice::clientConnectLimit) {
return command_result{error::client_join_rate_limit_reached};
if(config::voice::connectLimit > 0 && this->server->join_attempts["_"] + 1 > config::voice::connectLimit)
}
if(config::voice::connectLimit > 0 && general_join_attempts + 1 > config::voice::connectLimit) {
return command_result{error::server_join_rate_limit_reached};
this->server->join_attempts[inetAddr]++;
this->server->join_attempts["_"]++;
}
client_join_attempts++;
general_join_attempts++;
}
TIMING_STEP(timings, "join atmp c");
if(!DatabaseHelper::assignDatabaseId(this->server->getSql(), this->server->getServerId(), _this.lock()))
if(!DatabaseHelper::assignDatabaseId(this->server->getSql(), this->server->getServerId(), _this.lock())) {
return command_result{error::vs_critical, "Could not assign database id!"};
}
TIMING_STEP(timings, "db assign ");
this->server->getGroupManager()->enableCache(this->getClientDatabaseId());