A lot of updates for 1.4.12
This commit is contained in:
@@ -99,7 +99,7 @@ namespace ts::server {
|
||||
bool notifyServerUpdated(std::shared_ptr<ConnectedClient> ptr) override;
|
||||
bool notifyClientPoke(std::shared_ptr<ConnectedClient> invoker, std::string msg) override;
|
||||
|
||||
bool notifyClientUpdated(const std::shared_ptr<ConnectedClient> &ptr, const std::deque<std::shared_ptr<property::PropertyDescription>> &deque, bool lock_channel_tree) override;
|
||||
bool notifyClientUpdated(const std::shared_ptr<ConnectedClient> &ptr, const std::deque<const property::PropertyDescription*> &deque, bool lock_channel_tree) override;
|
||||
|
||||
bool notifyPluginCmd(std::string name, std::string msg,std::shared_ptr<ConnectedClient>) override;
|
||||
bool notifyClientChatComposing(const std::shared_ptr<ConnectedClient> &ptr) override;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <misc/base64.h>
|
||||
#include <src/ShutdownHelper.h>
|
||||
#include <ThreadPool/Timer.h>
|
||||
#include <numeric>
|
||||
|
||||
#include "src/client/command_handler/helpers.h"
|
||||
|
||||
@@ -397,37 +398,36 @@ command_result QueryClient::handleCommandServerInfo(Command &) {
|
||||
|
||||
|
||||
if(this->server && permission::v2::permission_granted(1, this->calculate_permission(permission::b_virtualserver_connectioninfo_view, 0))) {
|
||||
auto stats = this->server->getServerStatistics()->statistics();
|
||||
auto report = this->server->serverStatistics->dataReport();
|
||||
cmd["connection_bandwidth_sent_last_second_total"] = report.send_second;
|
||||
cmd["connection_bandwidth_sent_last_minute_total"] = report.send_minute;
|
||||
cmd["connection_bandwidth_received_last_second_total"] = report.recv_second;
|
||||
cmd["connection_bandwidth_received_last_minute_total"] = report.recv_minute;
|
||||
auto total_stats = this->server->getServerStatistics()->total_stats();
|
||||
auto report_second = this->server->serverStatistics->second_stats();
|
||||
auto report_minute = this->server->serverStatistics->minute_stats();
|
||||
cmd["connection_bandwidth_sent_last_second_total"] = std::accumulate(report_second.connection_bytes_sent.begin(), report_second.connection_bytes_sent.end(), 0U);
|
||||
cmd["connection_bandwidth_sent_last_minute_total"] = std::accumulate(report_minute.connection_bytes_sent.begin(), report_minute.connection_bytes_sent.end(), 0U);
|
||||
cmd["connection_bandwidth_received_last_second_total"] = std::accumulate(report_second.connection_bytes_received.begin(), report_second.connection_bytes_received.end(), 0U);
|
||||
cmd["connection_bandwidth_received_last_minute_total"] = std::accumulate(report_minute.connection_bytes_received.begin(), report_minute.connection_bytes_received.end(), 0U);
|
||||
|
||||
cmd["connection_filetransfer_bandwidth_sent"] = report.file_send;
|
||||
cmd["connection_filetransfer_bandwidth_received"] = report.file_recv;
|
||||
cmd["connection_filetransfer_bytes_sent_total"] = (*stats)[property::CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL].as<string>();
|
||||
cmd["connection_filetransfer_bytes_received_total"] = (*stats)[property::CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL].as<string>();
|
||||
cmd["connection_filetransfer_bandwidth_sent"] = report_minute.file_bytes_sent;
|
||||
cmd["connection_filetransfer_bandwidth_received"] = report_minute.file_bytes_received;
|
||||
|
||||
cmd["connection_packets_sent_speech"] = (*stats)[property::CONNECTION_FILETRANSFER_BANDWIDTH_SENT].value();
|
||||
cmd["connection_bytes_sent_speech"] = (*stats)[property::CONNECTION_FILETRANSFER_BANDWIDTH_RECEIVED].value();
|
||||
cmd["connection_packets_received_speech"] = (*stats)[property::CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL].value();
|
||||
cmd["connection_bytes_received_speech"] = (*stats)[property::CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL].value();
|
||||
cmd["connection_packets_sent_speech"] = total_stats.connection_packets_sent[stats::ConnectionStatistics::category::VOICE];
|
||||
cmd["connection_bytes_sent_speech"] = total_stats.connection_bytes_sent[stats::ConnectionStatistics::category::VOICE];
|
||||
cmd["connection_packets_received_speech"] = total_stats.connection_packets_received[stats::ConnectionStatistics::category::VOICE];
|
||||
cmd["connection_bytes_received_speech"] = total_stats.connection_bytes_received[stats::ConnectionStatistics::category::VOICE];
|
||||
|
||||
cmd["connection_packets_sent_keepalive"] = (*stats)[property::CONNECTION_PACKETS_SENT_KEEPALIVE].value();
|
||||
cmd["connection_packets_received_keepalive"] = (*stats)[property::CONNECTION_PACKETS_RECEIVED_KEEPALIVE].value();
|
||||
cmd["connection_bytes_received_keepalive"] = (*stats)[property::CONNECTION_BYTES_RECEIVED_KEEPALIVE].value();
|
||||
cmd["connection_bytes_sent_keepalive"] = (*stats)[property::CONNECTION_BYTES_SENT_KEEPALIVE].value();
|
||||
cmd["connection_packets_sent_keepalive"] = total_stats.connection_packets_sent[stats::ConnectionStatistics::category::KEEP_ALIVE];
|
||||
cmd["connection_packets_received_keepalive"] = total_stats.connection_bytes_sent[stats::ConnectionStatistics::category::KEEP_ALIVE];
|
||||
cmd["connection_bytes_received_keepalive"] = total_stats.connection_packets_received[stats::ConnectionStatistics::category::KEEP_ALIVE];
|
||||
cmd["connection_bytes_sent_keepalive"] = total_stats.connection_bytes_received[stats::ConnectionStatistics::category::KEEP_ALIVE];
|
||||
|
||||
cmd["connection_packets_sent_control"] = (*stats)[property::CONNECTION_PACKETS_SENT_CONTROL].value();
|
||||
cmd["connection_bytes_sent_control"] = (*stats)[property::CONNECTION_BYTES_SENT_CONTROL].value();
|
||||
cmd["connection_packets_received_control"] = (*stats)[property::CONNECTION_PACKETS_RECEIVED_CONTROL].value();
|
||||
cmd["connection_bytes_received_control"] = (*stats)[property::CONNECTION_BYTES_RECEIVED_CONTROL].value();
|
||||
cmd["connection_packets_sent_control"] = total_stats.connection_packets_sent[stats::ConnectionStatistics::category::COMMAND];
|
||||
cmd["connection_bytes_sent_control"] = total_stats.connection_bytes_sent[stats::ConnectionStatistics::category::COMMAND];
|
||||
cmd["connection_packets_received_control"] = total_stats.connection_packets_received[stats::ConnectionStatistics::category::COMMAND];
|
||||
cmd["connection_bytes_received_control"] = total_stats.connection_bytes_received[stats::ConnectionStatistics::category::COMMAND];
|
||||
|
||||
cmd["connection_packets_sent_total"] = (*stats)[property::CONNECTION_PACKETS_SENT_TOTAL].value();
|
||||
cmd["connection_bytes_sent_total"] = (*stats)[property::CONNECTION_BYTES_SENT_TOTAL].value();
|
||||
cmd["connection_packets_received_total"] = (*stats)[property::CONNECTION_PACKETS_RECEIVED_TOTAL].value();
|
||||
cmd["connection_bytes_received_total"] = (*stats)[property::CONNECTION_BYTES_RECEIVED_TOTAL].value();
|
||||
cmd["connection_packets_sent_total"] = std::accumulate(report_second.connection_packets_sent.begin(), report_second.connection_packets_sent.end(), 0U);
|
||||
cmd["connection_bytes_sent_total"] = std::accumulate(report_second.connection_bytes_sent.begin(), report_second.connection_bytes_sent.end(), 0U);
|
||||
cmd["connection_packets_received_total"] = std::accumulate(report_second.connection_packets_received.begin(), report_second.connection_packets_received.end(), 0U);
|
||||
cmd["connection_bytes_received_total"] = std::accumulate(report_second.connection_bytes_received.begin(), report_second.connection_bytes_received.end(), 0U);
|
||||
} else {
|
||||
cmd["connection_bandwidth_sent_last_second_total"] = "0";
|
||||
cmd["connection_bandwidth_sent_last_minute_total"] = "0";
|
||||
@@ -598,12 +598,12 @@ command_result QueryClient::handleCommandServerCreate(Command& cmd) {
|
||||
if(key == "virtualserver_port") continue;
|
||||
if(key == "virtualserver_host") continue;
|
||||
|
||||
auto info = property::impl::info<property::VirtualServerProperties>(key);
|
||||
if(*info == property::VIRTUALSERVER_UNDEFINED) {
|
||||
const auto& info = property::find<property::VirtualServerProperties>(key);
|
||||
if(info == property::VIRTUALSERVER_UNDEFINED) {
|
||||
logError(server->getServerId(), "Tried to change unknown server property " + key);
|
||||
continue;
|
||||
}
|
||||
if(!info->validate_input(cmd[key].as<string>())) {
|
||||
if(!info.validate_input(cmd[key].as<string>())) {
|
||||
logError(server->getServerId(), "Tried to change " + key + " to an invalid value: " + cmd[key].as<string>());
|
||||
continue;
|
||||
}
|
||||
@@ -722,9 +722,9 @@ command_result QueryClient::handleCommandInstanceEdit(Command& cmd) {
|
||||
ACTION_REQUIRES_INSTANCE_PERMISSION(permission::b_serverinstance_modify_settings, 1);
|
||||
|
||||
for(const auto &key : cmd[0].keys()){
|
||||
auto info = property::impl::info<property::InstanceProperties>(key);
|
||||
const auto* info = &property::find<property::InstanceProperties>(key);
|
||||
if(key == "serverinstance_serverquery_max_connections_per_ip")
|
||||
info = property::impl::info(property::SERVERINSTANCE_QUERY_MAX_CONNECTIONS_PER_IP);
|
||||
info = &property::describe(property::SERVERINSTANCE_QUERY_MAX_CONNECTIONS_PER_IP);
|
||||
|
||||
if(*info == property::SERVERINSTANCE_UNDEFINED) {
|
||||
logError(LOG_QUERY, "Query {} tried to change a non existing instance property: {}", this->getLoggingPeerIp(), key);
|
||||
@@ -758,22 +758,24 @@ command_result QueryClient::handleCommandHostInfo(Command &) {
|
||||
res["virtualservers_total_channels_online"] = vsReport.onlineChannels;
|
||||
|
||||
|
||||
auto stats = serverInstance->getStatistics()->statistics();
|
||||
res["connection_packets_sent_total"] = (*stats)[property::CONNECTION_PACKETS_SENT_TOTAL].as<string>();
|
||||
res["connection_bytes_sent_total"] = (*stats)[property::CONNECTION_BYTES_SENT_TOTAL].as<string>();
|
||||
res["connection_packets_received_total"] = (*stats)[property::CONNECTION_PACKETS_RECEIVED_TOTAL].as<string>();
|
||||
res["connection_bytes_received_total"] = (*stats)[property::CONNECTION_BYTES_RECEIVED_TOTAL].as<string>();
|
||||
auto total_stats = serverInstance->getStatistics()->total_stats();
|
||||
res["connection_packets_sent_total"] = std::accumulate(total_stats.connection_packets_sent.begin(), total_stats.connection_packets_sent.end(), 0U);
|
||||
res["connection_bytes_sent_total"] = std::accumulate(total_stats.connection_bytes_sent.begin(), total_stats.connection_bytes_sent.end(), 0U);
|
||||
res["connection_packets_received_total"] = std::accumulate(total_stats.connection_packets_received.begin(), total_stats.connection_packets_received.end(), 0U);
|
||||
res["connection_bytes_received_total"] = std::accumulate(total_stats.connection_bytes_received.begin(), total_stats.connection_bytes_received.end(), 0U);
|
||||
|
||||
auto report = serverInstance->getStatistics()->dataReport();
|
||||
res["connection_bandwidth_sent_last_second_total"] = report.send_second;
|
||||
res["connection_bandwidth_sent_last_minute_total"] = report.send_minute;
|
||||
res["connection_bandwidth_received_last_second_total"] = report.recv_second;
|
||||
res["connection_bandwidth_received_last_minute_total"] = report.recv_minute;
|
||||
auto report_second = serverInstance->getStatistics()->second_stats();
|
||||
auto report_minute = serverInstance->getStatistics()->minute_stats();
|
||||
res["connection_bandwidth_sent_last_second_total"] = std::accumulate(report_second.connection_bytes_sent.begin(), report_second.connection_bytes_sent.end(), 0U);
|
||||
res["connection_bandwidth_sent_last_minute_total"] = std::accumulate(report_minute.connection_bytes_sent.begin(), report_minute.connection_bytes_sent.end(), 0U);
|
||||
res["connection_bandwidth_received_last_second_total"] = std::accumulate(report_second.connection_bytes_received.begin(), report_second.connection_bytes_received.end(), 0U);
|
||||
res["connection_bandwidth_received_last_minute_total"] = std::accumulate(report_minute.connection_bytes_received.begin(), report_minute.connection_bytes_received.end(), 0U);
|
||||
|
||||
res["connection_filetransfer_bandwidth_sent"] = report.file_send;
|
||||
res["connection_filetransfer_bandwidth_received"] = report.file_recv;
|
||||
res["connection_filetransfer_bytes_sent_total"] = (*stats)[property::CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL].as<string>();
|
||||
res["connection_filetransfer_bytes_received_total"] = (*stats)[property::CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL].as<string>();
|
||||
|
||||
res["connection_filetransfer_bandwidth_sent"] = report_minute.file_bytes_sent;
|
||||
res["connection_filetransfer_bandwidth_received"] = report_minute.file_bytes_received;
|
||||
res["connection_filetransfer_bytes_sent_total"] = total_stats.file_bytes_sent;
|
||||
res["connection_filetransfer_bytes_received_total"] = total_stats.file_bytes_received;
|
||||
|
||||
this->sendCommand(res);
|
||||
return command_result{error::ok};
|
||||
|
||||
@@ -42,7 +42,7 @@ bool QueryClient::notifyServerUpdated(shared_ptr<ConnectedClient> ptr) {
|
||||
return ConnectedClient::notifyServerUpdated(ptr);
|
||||
}
|
||||
|
||||
bool QueryClient::notifyClientUpdated(const std::shared_ptr<ConnectedClient> &ptr, const std::deque<std::shared_ptr<property::PropertyDescription>> &deque, bool lock_channel_tree) {
|
||||
bool QueryClient::notifyClientUpdated(const std::shared_ptr<ConnectedClient> &ptr, const std::deque<const property::PropertyDescription*> &deque, bool lock_channel_tree) {
|
||||
CHK_EVENT(QEVENTGROUP_CLIENT_MISC, QEVENTSPECIFIER_CLIENT_MISC_UPDATE);
|
||||
return ConnectedClient::notifyClientUpdated(ptr, deque, lock_channel_tree);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user