Heavily improving the clients join and leave performance

This commit is contained in:
WolverinDEV
2021-04-15 03:28:08 +02:00
parent f41cfb8c30
commit 6e2e005ed7
21 changed files with 857 additions and 555 deletions
+8 -2
View File
@@ -90,12 +90,14 @@ bool VirtualServer::registerClient(shared_ptr<ConnectedClient> client) {
}
bool VirtualServer::unregisterClient(shared_ptr<ConnectedClient> cl, std::string reason, std::unique_lock<std::shared_mutex>& chan_tree_lock) {
if(cl->getType() == ClientType::CLIENT_TEAMSPEAK && cl->getType() == ClientType::CLIENT_WEB) {
if(cl->getType() == ClientType::CLIENT_TEAMSPEAK || cl->getType() == ClientType::CLIENT_TEASPEAK || cl->getType() == ClientType::CLIENT_WEB) {
sassert(cl->state == ConnectionState::DISCONNECTED);
}
auto client_id = cl->getClientId();
if(client_id == 0) return false; /* not registered */
if(client_id == 0) {
return false; /* not registered */
}
{
lock_guard lock(this->clients.lock);
@@ -252,6 +254,10 @@ bool VirtualServer::assignDefaultChannel(const shared_ptr<ConnectedClient>& clie
skip_permissions:;
}
/* Clear these parameters. We don't need them any more after we initially payed attention. */
client->properties()[property::CLIENT_DEFAULT_CHANNEL] = "";
client->properties()[property::CLIENT_DEFAULT_CHANNEL_PASSWORD] = "";
if(!channel) {
/* Client did not propose a channel or the proposed channel got rejected */
channel = this->channelTree->getDefaultChannel();