Fixed error spam and a memory leak

This commit is contained in:
WolverinDEV 2021-05-03 10:42:04 +02:00
parent 707ede7a6f
commit fb28e613cd
3 changed files with 8 additions and 5 deletions

View File

@ -1371,14 +1371,15 @@ std::deque<std::shared_ptr<EntryBinding>> 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<std::shared_ptr<EntryBinding>> 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 */

View File

@ -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();

View File

@ -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()) {