From fb28e613cdb54818f00659892d68c224e53d6936 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 3 May 2021 10:42:04 +0200 Subject: [PATCH] Fixed error spam and a memory leak --- server/src/Configuration.cpp | 8 +++++--- server/src/client/ConnectedClient.cpp | 2 +- server/src/manager/ConversationManager.cpp | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/server/src/Configuration.cpp b/server/src/Configuration.cpp index 25e537d..ba1379d 100644 --- a/server/src/Configuration.cpp +++ b/server/src/Configuration.cpp @@ -1371,14 +1371,15 @@ std::deque> config::create_bindings() { { CREATE_BINDING("not_allowed_message", FLAG_RELOADABLE); BIND_STRING(config::server::clients::teamspeak_not_allowed_message, ""); - ADD_DESCRIPTION("Chaneg the message, displayed when denying the access to the server"); + ADD_DESCRIPTION("Change the message, displayed when denying the access to the server"); ADD_NOTE_RELOADABLE(); } { CREATE_BINDING("teamspeak_message", 0); /* No reload flag else we could just manipulate the licensing thing */ BIND_STRING(config::server::clients::extra_welcome_message_teamspeak, ""); ADD_DESCRIPTION("Add an extra welcome message for TeamSpeak client users"); - ADD_NOTE_RELOADABLE(); + /* Don't make the reloadable else you could just disable the outdated client server join message */ + //ADD_NOTE_RELOADABLE(); } { CREATE_BINDING("teamspeak_message_type", 0); /* No reload flag else we could just manipulate the licensing thing */ @@ -1387,7 +1388,8 @@ std::deque> config::create_bindings() { ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_NONE) + " - None, do nothing"); ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_CHAT) + " - Message, sends this message before the server welcome message"); ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_POKE) + " - Message, pokes the client with the message when he enters the server"); - ADD_NOTE_RELOADABLE(); + /* Don't make the reloadable else you could just disable the outdated client server join message */ + //ADD_NOTE_RELOADABLE(); } /* TeaSpeak */ diff --git a/server/src/client/ConnectedClient.cpp b/server/src/client/ConnectedClient.cpp index 6f9fe14..34d4834 100644 --- a/server/src/client/ConnectedClient.cpp +++ b/server/src/client/ConnectedClient.cpp @@ -931,7 +931,7 @@ bool ConnectedClient::handleCommandFull(Command& cmd, bool disconnectOnFail) { } bool generateReturnStatus = false; - if(result.has_error() || this->getType() == ClientType::CLIENT_QUERY || this->getType() == ClientType::CLIENT_TEAMSPEAK){ + if(result.has_error() || this->getType() == ClientType::CLIENT_QUERY){ generateReturnStatus = true; } else if(cmd["return_code"].size() > 0) { generateReturnStatus = !cmd["return_code"].string().empty(); diff --git a/server/src/manager/ConversationManager.cpp b/server/src/manager/ConversationManager.cpp index 6330a59..3b96a2e 100644 --- a/server/src/manager/ConversationManager.cpp +++ b/server/src/manager/ConversationManager.cpp @@ -1001,8 +1001,9 @@ void Conversation::register_message(ts::ClientDbId sender_database_id, const std { lock_guard lock(this->_last_messages_lock); this->_last_messages.push_back(entry); - while(this->_last_messages.size() > this->_last_messages_limit) + while(this->_last_messages.size() > this->_last_messages_limit) { this->_last_messages.pop_front(); /* TODO: Use a iterator for delete to improve performance */ + } } if(!this->volatile_only()) {