From 76342bbb96d9bdbd2912f382a8dec6d085b39a63 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 3 Feb 2020 19:41:18 +0100 Subject: [PATCH] Updated the config and fixed stuff --- server/src/Configuration.cpp | 33 ++++++++++++++++--- server/src/client/command_handler/channel.cpp | 6 ++-- server/src/client/command_handler/client.cpp | 2 +- server/src/client/command_handler/music.cpp | 4 +-- server/src/client/command_handler/server.cpp | 4 +-- .../client/voice/VoiceClientPacketHandler.cpp | 3 ++ shared | 2 +- 7 files changed, 40 insertions(+), 14 deletions(-) diff --git a/server/src/Configuration.cpp b/server/src/Configuration.cpp index ba72a25..e22379e 100644 --- a/server/src/Configuration.cpp +++ b/server/src/Configuration.cpp @@ -318,7 +318,7 @@ void read_bindings(YAML::Node& root, const std::deque>& comments); std::deque> create_local_bindings(int& version, std::string& license); -#define CURRENT_CONFIG_VERSION 14 +#define CURRENT_CONFIG_VERSION 15 static std::string _config_path; vector config::parseConfig(const std::string& path) { _config_path = path; @@ -410,6 +410,29 @@ vector config::parseConfig(const std::string& path) { if(node_ft.IsDefined() && node_ft.as() == "0.0.0.0") node_ft = node_ft.as() + ",[::]"; } + case 14: + { + { + auto nodes_key = resolveNode(config, "threads.voice.execute_limit").back(); + if(nodes_key.IsDefined() && nodes_key.as() == 10) + nodes_key = "5"; + } + { + auto nodes_key = resolveNode(config, "threads.voice.io_limit").back(); + if(nodes_key.IsDefined() && nodes_key.as() == 10) + nodes_key = "5"; + } + { + auto nodes_key = resolveNode(config, "threads.web.io_loops").back(); + if(nodes_key.IsDefined() && nodes_key.as() == 4) + nodes_key = "2"; + } + { + auto nodes_key = resolveNode(config, "threads.music.execute_limit").back(); + if(nodes_key.IsDefined() && nodes_key.as() == 15) + nodes_key = "2"; + } + } default: break; } @@ -1566,7 +1589,7 @@ std::deque> config::create_bindings() { BIND_GROUP(music); { CREATE_BINDING("execute_limit", 0); - BIND_INTEGRAL(config::threads::music::execute_limit, 15, 1, 1024); + BIND_INTEGRAL(config::threads::music::execute_limit, 5, 1, 1024); ADD_DESCRIPTION("Max number of threads for command handling on the instance"); ADD_SENSITIVE(); } @@ -1579,7 +1602,7 @@ std::deque> config::create_bindings() { } { CREATE_BINDING("web.io_loops", 0); - BIND_INTEGRAL(config::threads::web::io_loops, 4, 1, 128); + BIND_INTEGRAL(config::threads::web::io_loops, 2, 1, 128); ADD_DESCRIPTION("Thread pool size for the ticking task of a VirtualServer"); ADD_SENSITIVE(); } @@ -1599,7 +1622,7 @@ std::deque> config::create_bindings() { } { CREATE_BINDING("execute_limit", 0); - BIND_INTEGRAL(config::threads::voice::execute_limit, 10, 1, 1024); + BIND_INTEGRAL(config::threads::voice::execute_limit, 5, 1, 1024); ADD_DESCRIPTION("Max number of threads for command handling threads within the instance"); ADD_SENSITIVE(); } @@ -1617,7 +1640,7 @@ std::deque> config::create_bindings() { } { CREATE_BINDING("io_limit", 0); - BIND_INTEGRAL(config::threads::voice::io_limit, 10, 1, 1024); + BIND_INTEGRAL(config::threads::voice::io_limit, 5, 1, 1024); ADD_DESCRIPTION("Max IO threads"); ADD_SENSITIVE(); } diff --git a/server/src/client/command_handler/channel.cpp b/server/src/client/command_handler/channel.cpp index 5271881..8f8126c 100644 --- a/server/src/client/command_handler/channel.cpp +++ b/server/src/client/command_handler/channel.cpp @@ -425,7 +425,7 @@ command_result ConnectedClient::handleCommandChannelGroupAddPerm(Command &cmd) { return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, 0, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, 0, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } @@ -1487,7 +1487,7 @@ command_result ConnectedClient::handleCommandChannelAddPerm(Command &cmd) { return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, channel_id, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, channel_id, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } @@ -1806,7 +1806,7 @@ command_result ConnectedClient::handleCommandChannelClientAddPerm(Command &cmd) return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, channel_id, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, channel_id, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } diff --git a/server/src/client/command_handler/client.cpp b/server/src/client/command_handler/client.cpp index 595e3c7..ced43f1 100644 --- a/server/src/client/command_handler/client.cpp +++ b/server/src/client/command_handler/client.cpp @@ -885,7 +885,7 @@ command_result ConnectedClient::handleCommandClientAddPerm(Command &cmd) { return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, 0, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, 0, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } diff --git a/server/src/client/command_handler/music.cpp b/server/src/client/command_handler/music.cpp index 76a93a6..fb42afe 100644 --- a/server/src/client/command_handler/music.cpp +++ b/server/src/client/command_handler/music.cpp @@ -573,7 +573,7 @@ command_result ConnectedClient::handleCommandPlaylistAddPerm(ts::Command &cmd) { return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, 0, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, 0, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } @@ -713,7 +713,7 @@ command_result ConnectedClient::handleCommandPlaylistClientAddPerm(ts::Command & return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, 0, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, 0, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } diff --git a/server/src/client/command_handler/server.cpp b/server/src/client/command_handler/server.cpp index 0852641..62ae0b5 100644 --- a/server/src/client/command_handler/server.cpp +++ b/server/src/client/command_handler/server.cpp @@ -820,7 +820,7 @@ command_result ConnectedClient::handleCommandServerGroupAddPerm(Command &cmd) { return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, 0, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, 0, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } @@ -983,7 +983,7 @@ command_result ConnectedClient::handleCommandServerGroupAutoAddPerm(ts::Command& return command_result{permission::i_permission_modify_power}; } - if(!ignore_granted_values && !permission::v2::permission_granted(val, this->calculate_permission(permType, 0, true))) { + if(!ignore_granted_values && !permission::v2::permission_granted(1, this->calculate_permission(permType, 0, true))) { if(conOnError) continue; return command_result{permission::i_permission_modify_power}; } diff --git a/server/src/client/voice/VoiceClientPacketHandler.cpp b/server/src/client/voice/VoiceClientPacketHandler.cpp index fcf6f56..3702b61 100644 --- a/server/src/client/voice/VoiceClientPacketHandler.cpp +++ b/server/src/client/voice/VoiceClientPacketHandler.cpp @@ -43,7 +43,10 @@ void VoiceClient::handlePacketCommand(const pipes::buffer_view& command_string) } void VoiceClient::handlePacketPing(const protocol::IncomingClientPacketParser& packet) { + (void) packet.payload().length(); if (packet.type() == protocol::PONG) { + if(packet.payload_length() < 2) return; + uint16_t id = be2le16((char*) packet.payload().data_ptr()); if (this->lastPingId == id) { #ifdef PKT_LOG_PING diff --git a/shared b/shared index 8f7d980..dca5bf1 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 8f7d980a6a8c841042e71dcb2a22098c84593859 +Subproject commit dca5bf1ce814ecfb63ebef21e579b9dc2781cbbc