Renamed TSServer to VirtualServer

This commit is contained in:
WolverinDEV 2020-01-26 18:04:38 +01:00
parent 2dc48747ed
commit 12aee2c958
71 changed files with 272 additions and 272 deletions

View File

@ -49,7 +49,7 @@ set(SERVER_SOURCE_FILES
src/client/voice/VoiceClientPacketHandler.cpp
src/client/voice/VoiceClientView.cpp
src/TS3ServerClientManager.cpp
src/TSServer.cpp
src/VirtualServer.cpp
src/TS3ServerHeartbeat.cpp
src/SignalHandler.cpp
src/server/VoiceServer.cpp

View File

@ -8,7 +8,7 @@
#include <ThreadPool/Timer.h>
#include "src/Configuration.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "src/InstanceHandler.h"
#include "src/server/QueryServer.h"
#include "src/server/file/FileServer.h"

View File

@ -4,7 +4,7 @@
#include <misc/memtracker.h>
#include "ConnectionStatistics.h"
#include "TSServer.h"
#include "VirtualServer.h"
using namespace std;
using namespace std::chrono;

View File

@ -7,7 +7,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
}
namespace stats {

View File

@ -72,7 +72,7 @@ int collectData(deque<shared_ptr<ClientDatabaseInfo>>* list, int length, char**
}
#define MAX_QUERY 32
std::deque<std::shared_ptr<ClientDatabaseInfo>> DatabaseHelper::queryDatabaseInfo(const std::shared_ptr<TSServer>& server, const std::deque<ClientDbId>& list) {
std::deque<std::shared_ptr<ClientDatabaseInfo>> DatabaseHelper::queryDatabaseInfo(const std::shared_ptr<VirtualServer>& server, const std::deque<ClientDbId>& list) {
if(list.empty()) return {};
deque<shared_ptr<ClientDatabaseInfo>> result;
@ -102,7 +102,7 @@ std::deque<std::shared_ptr<ClientDatabaseInfo>> DatabaseHelper::queryDatabaseInf
return result;
}
std::deque<std::shared_ptr<ClientDatabaseInfo>> DatabaseHelper::queryDatabaseInfoByUid(const std::shared_ptr<TSServer> &server, std::deque<std::string> list) {
std::deque<std::shared_ptr<ClientDatabaseInfo>> DatabaseHelper::queryDatabaseInfoByUid(const std::shared_ptr<VirtualServer> &server, std::deque<std::string> list) {
if(list.empty()) return {};
deque<shared_ptr<ClientDatabaseInfo>> result;
@ -132,9 +132,9 @@ std::deque<std::shared_ptr<ClientDatabaseInfo>> DatabaseHelper::queryDatabaseInf
return result;
}
bool DatabaseHelper::validClientDatabaseId(const std::shared_ptr<TSServer>& server, ClientDbId cldbid) { return cldbid > 0; } //TODO here check
bool DatabaseHelper::validClientDatabaseId(const std::shared_ptr<VirtualServer>& server, ClientDbId cldbid) { return cldbid > 0; } //TODO here check
void DatabaseHelper::deleteClient(const std::shared_ptr<TSServer>& server, ClientDbId cldbid) {
void DatabaseHelper::deleteClient(const std::shared_ptr<VirtualServer>& server, ClientDbId cldbid) {
ServerId sid = static_cast<ServerId>(server ? server->getServerId() : 0);
{
lock_guard<threads::Mutex> lock(permManagerLock);
@ -162,11 +162,11 @@ void DatabaseHelper::deleteClient(const std::shared_ptr<TSServer>& server, Clien
struct PermissionArguments {
sql::command& command;
PermissionManager* manager;
TSServer* server;
VirtualServer* server;
inline int serverId() { return this->server ? this->server->getServerId() : 0; }
};
inline sql::result load_permissions(const std::shared_ptr<TSServer>& server, PermissionManager* manager, sql::command& command) {
inline sql::result load_permissions(const std::shared_ptr<VirtualServer>& server, PermissionManager* manager, sql::command& command) {
auto start = system_clock::now();
auto data = PermissionArguments{command, manager, server.get()};
@ -232,7 +232,7 @@ inline sql::result load_permissions(const std::shared_ptr<TSServer>& server, Per
auto time = end - start;
logTrace(server ? server->getServerId() : 0, "[SQL] load_permissions(\"{}\") took {}ms", command.sqlCommand(), duration_cast<milliseconds>(time).count());
}
inline sql::result load_permissions_v2(const std::shared_ptr<TSServer>& server, v2::PermissionManager* manager, sql::command& command, bool resolve_channel /* only used for client permissions (client channel permissions) */) {
inline sql::result load_permissions_v2(const std::shared_ptr<VirtualServer>& server, v2::PermissionManager* manager, sql::command& command, bool resolve_channel /* only used for client permissions (client channel permissions) */) {
auto start = system_clock::now();
auto server_id = server ? server->getServerId() : 0;
@ -303,7 +303,7 @@ inline sql::result load_permissions_v2(const std::shared_ptr<TSServer>& server,
#define INSERT_COMMAND "INSERT INTO `permissions` (`serverId`, `type`, `id`, `channelId`, `permId`, `value`, `grant`, `flag_skip`, `flag_negate`) VALUES (:serverId, :type, :id, :chId, :permId, :value, :grant, :flag_skip, :flag_negate)"
#define DELETE_COMMAND "DELETE FROM `permissions` WHERE `serverId` = :serverId AND `type` = :type AND `id` = :id AND `permId` = :permId AND `channelId` = :chId"
std::shared_ptr<v2::PermissionManager> DatabaseHelper::loadClientPermissionManager(const std::shared_ptr<TSServer>& server, ClientDbId cldbid) {
std::shared_ptr<v2::PermissionManager> DatabaseHelper::loadClientPermissionManager(const std::shared_ptr<VirtualServer>& server, ClientDbId cldbid) {
auto server_id = server ? server->getServerId() : 0;
#ifndef DISABLE_CACHING
{
@ -375,7 +375,7 @@ std::shared_ptr<v2::PermissionManager> DatabaseHelper::loadClientPermissionManag
}
void DatabaseHelper::saveClientPermissions(const std::shared_ptr<ts::server::TSServer> &server, ts::ClientDbId client_dbid, const std::shared_ptr<ts::permission::v2::PermissionManager> &permissions) {
void DatabaseHelper::saveClientPermissions(const std::shared_ptr<ts::server::VirtualServer> &server, ts::ClientDbId client_dbid, const std::shared_ptr<ts::permission::v2::PermissionManager> &permissions) {
const auto updates = permissions->flush_db_updates();
if(updates.empty())
return;
@ -410,7 +410,7 @@ void DatabaseHelper::saveClientPermissions(const std::shared_ptr<ts::server::TSS
}
std::shared_ptr<permission::v2::PermissionManager> DatabaseHelper::loadGroupPermissions(const std::shared_ptr<TSServer>& server, ts::GroupId group_id) {
std::shared_ptr<permission::v2::PermissionManager> DatabaseHelper::loadGroupPermissions(const std::shared_ptr<VirtualServer>& server, ts::GroupId group_id) {
auto result = std::make_shared<v2::PermissionManager>();
if(this->use_startup_cache && server) {
shared_ptr<StartupCacheEntry> entry;
@ -442,7 +442,7 @@ std::shared_ptr<permission::v2::PermissionManager> DatabaseHelper::loadGroupPerm
return result;
}
void DatabaseHelper::saveGroupPermissions(const std::shared_ptr<ts::server::TSServer> &server, ts::GroupId group_id, const std::shared_ptr<ts::permission::v2::PermissionManager> &permissions) {
void DatabaseHelper::saveGroupPermissions(const std::shared_ptr<ts::server::VirtualServer> &server, ts::GroupId group_id, const std::shared_ptr<ts::permission::v2::PermissionManager> &permissions) {
const auto updates = permissions->flush_db_updates();
if(updates.empty())
return;
@ -476,7 +476,7 @@ void DatabaseHelper::saveGroupPermissions(const std::shared_ptr<ts::server::TSSe
}
}
std::shared_ptr<permission::PermissionManager> DatabaseHelper::loadPlaylistPermissions(const std::shared_ptr<ts::server::TSServer> &server, ts::PlaylistId playlist_id) {
std::shared_ptr<permission::PermissionManager> DatabaseHelper::loadPlaylistPermissions(const std::shared_ptr<ts::server::VirtualServer> &server, ts::PlaylistId playlist_id) {
shared_ptr<PermissionManager> result;
if(this->use_startup_cache && server) {
shared_ptr<StartupCacheEntry> entry;
@ -515,7 +515,7 @@ std::shared_ptr<permission::PermissionManager> DatabaseHelper::loadPlaylistPermi
}
assert(result);
weak_ptr<TSServer> weak_server = server;
weak_ptr<VirtualServer> weak_server = server;
auto server_id = server ? server->getServerId() : 0;
result->registerUpdateHandler([&, weak_server, server_id, playlist_id](std::shared_ptr<Permission> permission) {
@ -557,7 +557,7 @@ std::shared_ptr<permission::PermissionManager> DatabaseHelper::loadPlaylistPermi
return result;
}
std::shared_ptr<permission::v2::PermissionManager> DatabaseHelper::loadChannelPermissions(const std::shared_ptr<TSServer>& server, ts::ChannelId channel) {
std::shared_ptr<permission::v2::PermissionManager> DatabaseHelper::loadChannelPermissions(const std::shared_ptr<VirtualServer>& server, ts::ChannelId channel) {
auto result = std::make_shared<v2::PermissionManager>();
if(this->use_startup_cache && server) {
shared_ptr<StartupCacheEntry> entry;
@ -589,7 +589,7 @@ std::shared_ptr<permission::v2::PermissionManager> DatabaseHelper::loadChannelPe
return result;
}
void DatabaseHelper::saveChannelPermissions(const std::shared_ptr<ts::server::TSServer> &server, ts::ChannelId channel_id, const std::shared_ptr<ts::permission::v2::PermissionManager> &permissions) {
void DatabaseHelper::saveChannelPermissions(const std::shared_ptr<ts::server::VirtualServer> &server, ts::ChannelId channel_id, const std::shared_ptr<ts::permission::v2::PermissionManager> &permissions) {
const auto updates = permissions->flush_db_updates();
if(updates.empty())
return;
@ -726,7 +726,7 @@ inline sql::result load_properties(ServerId sid, deque<unique_ptr<FastPropertyEn
return result;
}
std::shared_ptr<Properties> DatabaseHelper::loadServerProperties(const std::shared_ptr<ts::server::TSServer>& server) {
std::shared_ptr<Properties> DatabaseHelper::loadServerProperties(const std::shared_ptr<ts::server::VirtualServer>& server) {
auto props = std::make_shared<Properties>();
props->register_property_type<property::VirtualServerProperties>();
@ -770,7 +770,7 @@ std::shared_ptr<Properties> DatabaseHelper::loadServerProperties(const std::shar
}
}
weak_ptr<TSServer> weak = server;
weak_ptr<VirtualServer> weak = server;
ServerId serverId = server ? server->getServerId() : 0;
props->registerNotifyHandler([&, serverId, weak](Property& prop){
if((prop.type().flags & property::FLAG_SAVE) == 0) {
@ -800,7 +800,7 @@ std::shared_ptr<Properties> DatabaseHelper::loadServerProperties(const std::shar
return props;
}
std::shared_ptr<Properties> DatabaseHelper::loadPlaylistProperties(const std::shared_ptr<ts::server::TSServer>& server, PlaylistId id) {
std::shared_ptr<Properties> DatabaseHelper::loadPlaylistProperties(const std::shared_ptr<ts::server::VirtualServer>& server, PlaylistId id) {
auto props = std::make_shared<Properties>();
props->register_property_type<property::PlaylistProperties>();
@ -843,7 +843,7 @@ std::shared_ptr<Properties> DatabaseHelper::loadPlaylistProperties(const std::sh
}
}
weak_ptr<TSServer> weak = server;
weak_ptr<VirtualServer> weak = server;
ServerId serverId = server ? server->getServerId() : 0;
props->registerNotifyHandler([&, serverId, weak, id](Property& prop){
if((prop.type().flags & property::FLAG_SAVE) == 0) {
@ -873,7 +873,7 @@ std::shared_ptr<Properties> DatabaseHelper::loadPlaylistProperties(const std::sh
return props;
}
std::shared_ptr<Properties> DatabaseHelper::loadChannelProperties(const shared_ptr<TSServer>& server, ChannelId channel) {
std::shared_ptr<Properties> DatabaseHelper::loadChannelProperties(const shared_ptr<VirtualServer>& server, ChannelId channel) {
ServerId serverId = server ? server->getServerId() : 0U;
auto props = std::make_shared<Properties>();
@ -920,7 +920,7 @@ std::shared_ptr<Properties> DatabaseHelper::loadChannelProperties(const shared_p
}
}
weak_ptr<TSServer> weak = server;
weak_ptr<VirtualServer> weak = server;
props->registerNotifyHandler([&, weak, serverId, channel](Property& prop){
auto weak_server = weak.lock();
if(!weak_server && serverId != 0)
@ -954,7 +954,7 @@ std::shared_ptr<Properties> DatabaseHelper::loadChannelProperties(const shared_p
return props;
}
std::shared_ptr<Properties> DatabaseHelper::loadClientProperties(const std::shared_ptr<TSServer>& server, ClientDbId cldbid, ClientType type) {
std::shared_ptr<Properties> DatabaseHelper::loadClientProperties(const std::shared_ptr<VirtualServer>& server, ClientDbId cldbid, ClientType type) {
auto props = DatabaseHelper::default_properties_client(nullptr, type);
if(server) {
props->operator[](property::CLIENT_DESCRIPTION) = server->properties()[property::VIRTUALSERVER_DEFAULT_CLIENT_DESCRIPTION].value();
@ -997,7 +997,7 @@ std::shared_ptr<Properties> DatabaseHelper::loadClientProperties(const std::shar
}
weak_ptr<TSServer> weak_server = server;
weak_ptr<VirtualServer> weak_server = server;
auto server_id = server ? server->getServerId() : 0;
props->registerNotifyHandler([&, weak_server, server_id, cldbid, type](Property& prop){ //General save
auto server = weak_server.lock();
@ -1237,7 +1237,7 @@ void DatabaseHelper::loadStartupPropertyCache() {
}, &arg);
}
bool DatabaseHelper::deleteGroupPermissions(const std::shared_ptr<ts::server::TSServer> &server, ts::GroupId group_id) {
bool DatabaseHelper::deleteGroupPermissions(const std::shared_ptr<ts::server::VirtualServer> &server, ts::GroupId group_id) {
auto command = sql::command(this->sql, "DELETE FROM `permissions` WHERE `serverId` = :serverId AND `type` = :type AND `id` = :id",
variable{":serverId", server ? server->getServerId() : 0},
variable{":type", permission::SQL_PERM_GROUP},
@ -1246,7 +1246,7 @@ bool DatabaseHelper::deleteGroupPermissions(const std::shared_ptr<ts::server::TS
return !!command;
}
bool DatabaseHelper::deleteChannelPermissions(const std::shared_ptr<ts::server::TSServer> &server, ts::ChannelId channel_id) {
bool DatabaseHelper::deleteChannelPermissions(const std::shared_ptr<ts::server::VirtualServer> &server, ts::ChannelId channel_id) {
auto command = sql::command(sql, "DELETE FROM `permissions` WHERE `serverId` = :serverId AND `channelId` = :chid",
variable{":serverId", server ? server->getServerId() : 0},
variable{":chid", channel_id}).execute();
@ -1263,7 +1263,7 @@ std::deque<std::unique_ptr<FastPropertyEntry>> DatabaseHelper::query_properties(
return result;
}
bool DatabaseHelper::deletePlaylist(const std::shared_ptr<ts::server::TSServer> &server, ts::PlaylistId playlist_id) {
bool DatabaseHelper::deletePlaylist(const std::shared_ptr<ts::server::VirtualServer> &server, ts::PlaylistId playlist_id) {
auto server_id = server ? server->getServerId() : (ServerId) 0;
sql::command(this->sql, "DELETE FROM `playlists` WHERE `serverId` = :server_id AND `playlist_id` = :playlist_id",

View File

@ -10,7 +10,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class DataClient;
struct ClientDatabaseInfo {
@ -86,30 +86,30 @@ namespace ts {
size_t cacheBinarySize();
void clearStartupCache(ServerId sid = 0);
void deleteClient(const std::shared_ptr<TSServer>&,ClientDbId);
bool validClientDatabaseId(const std::shared_ptr<TSServer>&, ClientDbId);
std::deque<std::shared_ptr<ClientDatabaseInfo>> queryDatabaseInfo(const std::shared_ptr<TSServer>&, const std::deque<ClientDbId>&);
std::deque<std::shared_ptr<ClientDatabaseInfo>> queryDatabaseInfoByUid(const std::shared_ptr<TSServer> &, std::deque<std::string>);
void deleteClient(const std::shared_ptr<VirtualServer>&,ClientDbId);
bool validClientDatabaseId(const std::shared_ptr<VirtualServer>&, ClientDbId);
std::deque<std::shared_ptr<ClientDatabaseInfo>> queryDatabaseInfo(const std::shared_ptr<VirtualServer>&, const std::deque<ClientDbId>&);
std::deque<std::shared_ptr<ClientDatabaseInfo>> queryDatabaseInfoByUid(const std::shared_ptr<VirtualServer> &, std::deque<std::string>);
std::shared_ptr<permission::v2::PermissionManager> loadClientPermissionManager(const std::shared_ptr<TSServer>&, ClientDbId); //Just and write
void saveClientPermissions(const std::shared_ptr<TSServer>&, ClientDbId , const std::shared_ptr<permission::v2::PermissionManager>& /* permission manager */);
std::shared_ptr<permission::v2::PermissionManager> loadClientPermissionManager(const std::shared_ptr<VirtualServer>&, ClientDbId); //Just and write
void saveClientPermissions(const std::shared_ptr<VirtualServer>&, ClientDbId , const std::shared_ptr<permission::v2::PermissionManager>& /* permission manager */);
std::shared_ptr<permission::v2::PermissionManager> loadChannelPermissions(const std::shared_ptr<TSServer>&, ChannelId); //Just read
void saveChannelPermissions(const std::shared_ptr<TSServer>&, ChannelId, const std::shared_ptr<permission::v2::PermissionManager>& /* permission manager */);
std::shared_ptr<permission::v2::PermissionManager> loadChannelPermissions(const std::shared_ptr<VirtualServer>&, ChannelId); //Just read
void saveChannelPermissions(const std::shared_ptr<VirtualServer>&, ChannelId, const std::shared_ptr<permission::v2::PermissionManager>& /* permission manager */);
std::shared_ptr<permission::v2::PermissionManager> loadGroupPermissions(const std::shared_ptr<TSServer>&, GroupId); //Just read
void saveGroupPermissions(const std::shared_ptr<TSServer>&, GroupId, const std::shared_ptr<permission::v2::PermissionManager>& /* permission manager */);
std::shared_ptr<permission::v2::PermissionManager> loadGroupPermissions(const std::shared_ptr<VirtualServer>&, GroupId); //Just read
void saveGroupPermissions(const std::shared_ptr<VirtualServer>&, GroupId, const std::shared_ptr<permission::v2::PermissionManager>& /* permission manager */);
std::shared_ptr<permission::PermissionManager> loadPlaylistPermissions(const std::shared_ptr<TSServer>&, PlaylistId /* playlist id */); //Read and write
std::shared_ptr<permission::PermissionManager> loadPlaylistPermissions(const std::shared_ptr<VirtualServer>&, PlaylistId /* playlist id */); //Read and write
std::shared_ptr<Properties> loadServerProperties(const std::shared_ptr<TSServer>&); //Read and write
std::shared_ptr<Properties> loadPlaylistProperties(const std::shared_ptr<TSServer>&, PlaylistId); //Read and write
std::shared_ptr<Properties> loadChannelProperties(const std::shared_ptr<TSServer>&, ChannelId); //Read and write
std::shared_ptr<Properties> loadClientProperties(const std::shared_ptr<TSServer>&, ClientDbId, ClientType);
std::shared_ptr<Properties> loadServerProperties(const std::shared_ptr<VirtualServer>&); //Read and write
std::shared_ptr<Properties> loadPlaylistProperties(const std::shared_ptr<VirtualServer>&, PlaylistId); //Read and write
std::shared_ptr<Properties> loadChannelProperties(const std::shared_ptr<VirtualServer>&, ChannelId); //Read and write
std::shared_ptr<Properties> loadClientProperties(const std::shared_ptr<VirtualServer>&, ClientDbId, ClientType);
bool deleteGroupPermissions(const std::shared_ptr<TSServer>&, GroupId);
bool deleteChannelPermissions(const std::shared_ptr<TSServer>&, ChannelId);
bool deletePlaylist(const std::shared_ptr<TSServer>&, PlaylistId /* playlist id */);
bool deleteGroupPermissions(const std::shared_ptr<VirtualServer>&, GroupId);
bool deleteChannelPermissions(const std::shared_ptr<VirtualServer>&, ChannelId);
bool deletePlaylist(const std::shared_ptr<VirtualServer>&, PlaylistId /* playlist id */);
std::deque<std::unique_ptr<FastPropertyEntry>> query_properties(ServerId /* server */, property::PropertyType /* type */, uint64_t /* id */); /* required for server snapshots */
void tick();

View File

@ -3,7 +3,7 @@
#include <log/LogUtils.h>
#include <misc/memtracker.h>
#include "Group.h"
#include "TSServer.h"
#include "VirtualServer.h"
#include "src/client/ConnectedClient.h"
#include "InstanceHandler.h"
#include "src/server/file/FileServer.h"
@ -88,7 +88,7 @@ Group::~Group() {
memtrack::freed<Group>(this);
}
GroupManager::GroupManager(const shared_ptr<TSServer> &server, sql::SqlManager *sql, std::shared_ptr<GroupManager> root) : server(server), sql(sql), root(std::move(root)) { }
GroupManager::GroupManager(const shared_ptr<VirtualServer> &server, sql::SqlManager *sql, std::shared_ptr<GroupManager> root) : server(server), sql(sql), root(std::move(root)) { }
GroupManager::~GroupManager() {}

View File

@ -13,7 +13,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class ConnectedClient;
}
@ -145,11 +145,11 @@ namespace ts {
class GroupManager {
friend class ServerChannelTree;
friend class Group;
friend class server::TSServer;
friend class server::VirtualServer;
public:
static int64_t generateGroupId(sql::SqlManager* sql);
GroupManager(const std::shared_ptr<server::TSServer> &, sql::SqlManager *, std::shared_ptr<GroupManager> root = nullptr);
GroupManager(const std::shared_ptr<server::VirtualServer> &, sql::SqlManager *, std::shared_ptr<GroupManager> root = nullptr);
~GroupManager();
bool loadGroupFormDatabase(GroupId id = 0);
@ -221,7 +221,7 @@ namespace ts {
void handleChannelDeleted(const ChannelId& /* channel id */);
private:
std::shared_ptr<GroupManager> root = nullptr;
std::weak_ptr<server::TSServer> server;
std::weak_ptr<server::VirtualServer> server;
ServerId getServerId();
sql::SqlManager* sql;

View File

@ -182,14 +182,14 @@ InstanceHandler::InstanceHandler(SqlDataManager *sql) : sql(sql) {
this->web_list = make_shared<weblist::WebListManager>();
}
void InstanceHandler::executeTick(TSServer* server) {
void InstanceHandler::executeTick(VirtualServer* server) {
auto str = "server_" + to_string(server->getServerId());
if(!this->tick_manager->schedule(str, std::bind(&TSServer::executeServerTick, server), milliseconds(500))) {
if(!this->tick_manager->schedule(str, std::bind(&VirtualServer::executeServerTick, server), milliseconds(500))) {
logCritical(LOG_INSTANCE, "Could not schedule server ticking task!");
}
}
void InstanceHandler::cancelExecute(TSServer* server) {
void InstanceHandler::cancelExecute(VirtualServer* server) {
auto str = "server_" + to_string(server->getServerId());
if(!this->tick_manager->cancelTask(str)){
logError(LOG_INSTANCE, "Could not stop server tick task!");

View File

@ -48,8 +48,8 @@ namespace ts {
std::chrono::time_point<std::chrono::system_clock> getStartTimestamp(){ return startTimestamp; }
void executeTick(TSServer*);
void cancelExecute(TSServer*);
void executeTick(VirtualServer*);
void cancelExecute(VirtualServer*);
bool reloadConfig(std::vector<std::string>& /* errors */, bool /* reload file */);
void setWebCertRoot(const std::string& /* key */, const std::string& /* certificate */, const std::string& /* revision */);

View File

@ -119,7 +119,7 @@ bool ServerManager::initialize(bool autostart) {
}
auto server = make_shared<TSServer>(id, this->handle->getSql());
auto server = make_shared<VirtualServer>(id, this->handle->getSql());
server->self = server;
if(!server->initialize(true)) {
//FIXME error handling
@ -180,14 +180,14 @@ bool ServerManager::initialize(bool autostart) {
return true;
}
shared_ptr<TSServer> ServerManager::findServerById(ServerId sid) {
shared_ptr<VirtualServer> ServerManager::findServerById(ServerId sid) {
for(auto server : this->serverInstances())
if(server->getServerId() == sid)
return server;
return nullptr;
}
shared_ptr<TSServer> ServerManager::findServerByPort(uint16_t port) {
shared_ptr<VirtualServer> ServerManager::findServerByPort(uint16_t port) {
for(const auto& server : this->serverInstances()){
if(server->properties()[property::VIRTUALSERVER_PORT] == port) return server;
if(server->running() && server->getVoiceServer())
@ -306,7 +306,7 @@ size_t ServerManager::usedSlots() {
return res;
}
shared_ptr<TSServer> ServerManager::createServer(std::string hosts, uint16_t port) {
shared_ptr<VirtualServer> ServerManager::createServer(std::string hosts, uint16_t port) {
bool sid_success = false;
ServerId serverId = this->next_available_server_id(sid_success);
@ -321,7 +321,7 @@ shared_ptr<TSServer> ServerManager::createServer(std::string hosts, uint16_t por
if(!prop_copy.success)
logCritical(LOG_GENERAL, "Failed to copy default server properties: {}", prop_copy.fmtStr());
auto server = make_shared<TSServer>(serverId, this->handle->getSql());
auto server = make_shared<VirtualServer>(serverId, this->handle->getSql());
server->self = server;
if(!server->initialize(true)) {
//FIXME error handling
@ -337,7 +337,7 @@ shared_ptr<TSServer> ServerManager::createServer(std::string hosts, uint16_t por
return server;
}
bool ServerManager::deleteServer(shared_ptr<TSServer> server) {
bool ServerManager::deleteServer(shared_ptr<VirtualServer> server) {
{
threads::MutexLock l(this->instanceLock);
bool found = false;
@ -347,7 +347,7 @@ bool ServerManager::deleteServer(shared_ptr<TSServer> server) {
break;
}
if(!found) return false;
this->instances.erase(std::remove_if(this->instances.begin(), this->instances.end(), [&](const shared_ptr<TSServer>& s) {
this->instances.erase(std::remove_if(this->instances.begin(), this->instances.end(), [&](const shared_ptr<VirtualServer>& s) {
return s == server;
}), this->instances.end());
}

View File

@ -4,7 +4,7 @@
#include <EventLoop.h>
#include "client/voice/PrecomputedPuzzles.h"
#include "server/VoiceIOManager.h"
#include "TSServer.h"
#include "VirtualServer.h"
namespace ts {
namespace server {
@ -32,15 +32,15 @@ namespace ts {
bool initialize(bool execute_autostart = true);
std::shared_ptr<TSServer> createServer(std::string, uint16_t);
bool deleteServer(std::shared_ptr<TSServer>);
std::shared_ptr<VirtualServer> createServer(std::string, uint16_t);
bool deleteServer(std::shared_ptr<VirtualServer>);
std::shared_ptr<TSServer> findServerById(ServerId);
std::shared_ptr<TSServer> findServerByPort(uint16_t);
std::shared_ptr<VirtualServer> findServerById(ServerId);
std::shared_ptr<VirtualServer> findServerByPort(uint16_t);
uint16_t next_available_port();
ServerId next_available_server_id(bool& /* success */);
std::deque<std::shared_ptr<TSServer>> serverInstances(){
std::deque<std::shared_ptr<VirtualServer>> serverInstances(){
threads::MutexLock l(this->instanceLock);
return instances;
}
@ -54,8 +54,8 @@ namespace ts {
void shutdownAll(const std::string&);
//Dotn use shared_ptr references to keep sure that they be hold in memory
bool createServerSnapshot(Command &cmd, std::shared_ptr<TSServer> server, int version, std::string &error);
std::shared_ptr<TSServer> createServerFromSnapshot(std::shared_ptr<TSServer> old, std::string, uint16_t, const ts::Command &, std::string &);
bool createServerSnapshot(Command &cmd, std::shared_ptr<VirtualServer> server, int version, std::string &error);
std::shared_ptr<VirtualServer> createServerFromSnapshot(std::shared_ptr<VirtualServer> old, std::string, uint16_t, const ts::Command &, std::string &);
size_t maxSlotLimit(){ return 254; }
@ -81,7 +81,7 @@ namespace ts {
State state = State::STOPPED;
InstanceHandler* handle;
threads::Mutex instanceLock;
std::deque<std::shared_ptr<TSServer>> instances;
std::deque<std::shared_ptr<VirtualServer>> instances;
protocol::PuzzleManager* puzzles = nullptr;
event::EventExecutor* execute_loop = nullptr;

View File

@ -163,7 +163,7 @@ struct SnapshotPermissionEntry {
}
};
std::shared_ptr<TSServer> ServerManager::createServerFromSnapshot(shared_ptr<TSServer> old, std::string host,
std::shared_ptr<VirtualServer> ServerManager::createServerFromSnapshot(shared_ptr<VirtualServer> old, std::string host,
uint16_t port, const ts::Command &arguments,
std::string &error) {
ServerId serverId = 0;
@ -671,7 +671,7 @@ std::shared_ptr<TSServer> ServerManager::createServerFromSnapshot(shared_ptr<TSS
if(old)
this->deleteServer(old);
//Now we load the server
auto server = make_shared<TSServer>(serverId, this->handle->getSql());
auto server = make_shared<VirtualServer>(serverId, this->handle->getSql());
server->self = server;
if(!server->initialize(false)) {
//FIXME Error handling!
@ -721,7 +721,7 @@ inline bool writePermissions(const shared_ptr<permission::v2::PermissionManager>
return true;
}
inline void writeRelations(const shared_ptr<TSServer>& server, GroupTarget type, Command& cmd, int& index, int version) {
inline void writeRelations(const shared_ptr<VirtualServer>& server, GroupTarget type, Command& cmd, int& index, int version) {
PermissionCommandTuple parm{cmd, index, version, 0, 0};
auto res = sql::command(server->getSql(), "SELECT `cldbid`, `groups`.`groupId`, `channelId`, `until` FROM `assignedGroups` INNER JOIN `groups` ON `groups`.`serverId` = `assignedGroups`.`serverId` AND `groups`.`groupId` = `assignedGroups`.`groupId` WHERE `groups`.`serverId` = :sid AND `groups`.target = :type",
variable{":sid", server->getServerId()},
@ -767,7 +767,7 @@ struct DatabaseMusicbot {
std::string bot_unique_id;
};
bool ServerManager::createServerSnapshot(Command &cmd, shared_ptr<TSServer> server, int version, std::string &error) {
bool ServerManager::createServerSnapshot(Command &cmd, shared_ptr<VirtualServer> server, int version, std::string &error) {
int index = 0;

View File

@ -1,6 +1,6 @@
#include <breakpad/client/linux/handler/exception_handler.h>
#include "TSServer.h"
#include "VirtualServer.h"
#include "SignalHandler.h"
#include "ServerManager.h"
#include "InstanceHandler.h"

View File

@ -2,7 +2,7 @@
#include <protocol/buffers.h>
#include "client/voice/VoiceClient.h"
#include "client/InternalClient.h"
#include "TSServer.h"
#include "VirtualServer.h"
#include <misc/timer.h>
#include <log/LogUtils.h>
#include <misc/sassert.h>
@ -15,7 +15,7 @@ using namespace ts::buffer;
using namespace ts::permission;
using namespace std::chrono;
bool TSServer::registerClient(shared_ptr<ConnectedClient> client) {
bool VirtualServer::registerClient(shared_ptr<ConnectedClient> client) {
sassert(client);
{
@ -86,7 +86,7 @@ bool TSServer::registerClient(shared_ptr<ConnectedClient> client) {
return true;
}
bool TSServer::unregisterClient(shared_ptr<ConnectedClient> cl, std::string reason, std::unique_lock<std::shared_mutex>& chan_tree_lock) {
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) {
sassert(cl->state == ConnectionState::DISCONNECTED);
}
@ -127,7 +127,7 @@ bool TSServer::unregisterClient(shared_ptr<ConnectedClient> cl, std::string reas
return true;
}
void TSServer::registerInternalClient(std::shared_ptr<ConnectedClient> client) {
void VirtualServer::registerInternalClient(std::shared_ptr<ConnectedClient> client) {
client->state = ConnectionState::CONNECTED;
{
lock_guard lock(this->clients.lock);
@ -151,7 +151,7 @@ void TSServer::registerInternalClient(std::shared_ptr<ConnectedClient> client) {
}
}
void TSServer::unregisterInternalClient(std::shared_ptr<ConnectedClient> client) {
void VirtualServer::unregisterInternalClient(std::shared_ptr<ConnectedClient> client) {
client->state = ConnectionState::DISCONNECTED;
{
@ -172,7 +172,7 @@ void TSServer::unregisterInternalClient(std::shared_ptr<ConnectedClient> client)
}
}
bool TSServer::assignDefaultChannel(const shared_ptr<ConnectedClient>& client, bool join) {
bool VirtualServer::assignDefaultChannel(const shared_ptr<ConnectedClient>& client, bool join) {
shared_lock server_channel_lock(this->channel_tree_lock);
std::shared_ptr<BasicChannel> channel = nullptr;
if(client->properties()->hasProperty(property::CLIENT_DEFAULT_CHANNEL) && !client->properties()[property::CLIENT_DEFAULT_CHANNEL].as<string>().empty()) {
@ -208,7 +208,7 @@ bool TSServer::assignDefaultChannel(const shared_ptr<ConnectedClient>& client, b
return true;
}
void TSServer::testBanStateChange(const std::shared_ptr<ConnectedClient>& invoker) {
void VirtualServer::testBanStateChange(const std::shared_ptr<ConnectedClient>& invoker) {
this->forEachClient([&](shared_ptr<ConnectedClient> client) {
auto ban = client->resolveActiveBan(client->getPeerIp());
if(ban) {
@ -220,7 +220,7 @@ void TSServer::testBanStateChange(const std::shared_ptr<ConnectedClient>& invoke
});
}
bool TSServer::could_default_create_channel() {
bool VirtualServer::could_default_create_channel() {
{
auto default_group = this->getGroupManager()->defaultGroup(GroupTarget::GROUPTARGET_SERVER);
@ -254,7 +254,7 @@ bool TSServer::could_default_create_channel() {
cl->notifyClientLeftViewKicked(client, client->currentChannel, nullptr, cmd["reasonmsg"].as<std::string>(), this);
*/
void TSServer::notify_client_ban(const shared_ptr<ConnectedClient> &target, const std::shared_ptr<ts::server::ConnectedClient> &invoker, const std::string &reason, size_t time) {
void VirtualServer::notify_client_ban(const shared_ptr<ConnectedClient> &target, const std::shared_ptr<ts::server::ConnectedClient> &invoker, const std::string &reason, size_t time) {
/* the target is not allowed to execute anything; Must before channel tree lock because the target may waits for us to finish the channel stuff */
lock_guard command_lock(target->command_lock);
unique_lock server_channel_lock(this->channel_tree_lock); /* we're "moving" a client! */
@ -279,7 +279,7 @@ void TSServer::notify_client_ban(const shared_ptr<ConnectedClient> &target, cons
target->currentChannel = nullptr;
}
void TSServer::notify_client_kick(
void VirtualServer::notify_client_kick(
const std::shared_ptr<ts::server::ConnectedClient> &target,
const std::shared_ptr<ts::server::ConnectedClient> &invoker,
const std::string &reason,
@ -323,7 +323,7 @@ void TSServer::notify_client_kick(
*
* Note: channel cant be a ref because the channel itself gets deleted!
*/
void TSServer::delete_channel(shared_ptr<ts::ServerChannel> channel, const shared_ptr<ConnectedClient> &invoker, const std::string& kick_message, unique_lock<std::shared_mutex> &tree_lock) {
void VirtualServer::delete_channel(shared_ptr<ts::ServerChannel> channel, const shared_ptr<ConnectedClient> &invoker, const std::string& kick_message, unique_lock<std::shared_mutex> &tree_lock) {
if(!tree_lock.owns_lock())
tree_lock.lock();
if(channel->deleted)
@ -365,7 +365,7 @@ void TSServer::delete_channel(shared_ptr<ts::ServerChannel> channel, const share
});
}
void TSServer::client_move(
void VirtualServer::client_move(
const shared_ptr<ts::server::ConnectedClient> &target,
shared_ptr<ts::BasicChannel> target_channel,
const std::shared_ptr<ts::server::ConnectedClient> &invoker,

View File

@ -3,7 +3,7 @@
#include "client/voice/VoiceClient.h"
#include <log/LogUtils.h>
#include "InstanceHandler.h"
#include "TSServer.h"
#include "VirtualServer.h"
#include "./manager/ConversationManager.h"
using namespace std;
@ -13,7 +13,7 @@ using namespace ts::protocol;
using namespace ts::buffer;
extern InstanceHandler* serverInstance;
inline void banClientFlood(TSServer* server, const shared_ptr<ConnectedClient>& cl, time_point<system_clock> until){
inline void banClientFlood(VirtualServer* server, const shared_ptr<ConnectedClient>& cl, time_point<system_clock> until){
auto time = until.time_since_epoch().count() == 0 ? 0L : chrono::ceil<chrono::seconds>(until - system_clock::now()).count();
std::string reason = "You're flooding too much";
@ -30,7 +30,7 @@ inline void banClientFlood(TSServer* server, const shared_ptr<ConnectedClient>&
timing_end = system_clock::now(); \
variable = duration_cast<decltype(variable)>(timing_end - timing_begin);
void TSServer::executeServerTick() {
void VirtualServer::executeServerTick() {
threads::MutexTryLock l(this->stateLock); //Should not attempt to shutdown or start the server while ticking
if(!l) {
if(this->running())

View File

@ -21,7 +21,7 @@
#include "server/QueryServer.h"
#include "InstanceHandler.h"
#include "Configuration.h"
#include "TSServer.h"
#include "VirtualServer.h"
#include "src/manager/ConversationManager.h"
#include <misc/sassert.h>
@ -39,11 +39,11 @@ using namespace ts::buffer;
#endif
extern ts::server::InstanceHandler* serverInstance;
TSServer::TSServer(uint16_t serverId, sql::SqlManager* database) : serverId(serverId), sql(database) {
memtrack::allocated<TSServer>(this);
VirtualServer::VirtualServer(uint16_t serverId, sql::SqlManager* database) : serverId(serverId), sql(database) {
memtrack::allocated<VirtualServer>(this);
}
bool TSServer::initialize(bool test_properties) {
bool VirtualServer::initialize(bool test_properties) {
assert(self.lock());
this->_properties = serverInstance->databaseHelper()->loadServerProperties(self.lock());
@ -232,8 +232,8 @@ bool TSServer::initialize(bool test_properties) {
return true;
}
TSServer::~TSServer() {
memtrack::freed<TSServer>(this);
VirtualServer::~VirtualServer() {
memtrack::freed<VirtualServer>(this);
delete this->tokenManager;
delete this->groups;
delete this->channelTree;
@ -289,7 +289,7 @@ inline vector<string> split_hosts(const std::string& message, char delimiter) {
return result;
}
bool TSServer::start(std::string& error) {
bool VirtualServer::start(std::string& error) {
{
threads::Mutex lock(this->stateLock);
if(this->state != ServerState::OFFLINE){
@ -433,18 +433,18 @@ bool TSServer::start(std::string& error) {
return true;
}
std::string TSServer::publicServerKey() {
std::string VirtualServer::publicServerKey() {
size_t keyBufferLength = 265;
char keyBuffer[keyBufferLength];
if(ecc_export((unsigned char *) keyBuffer, &keyBufferLength, PK_PUBLIC, this->_serverKey) != CRYPT_OK) return "";
return base64::encode(string(keyBuffer, keyBufferLength));
}
bool TSServer::running() {
bool VirtualServer::running() {
return this->state == ServerState::BOOTING || this->state == ServerState::ONLINE;
}
void TSServer::preStop(const std::string& reason) {
void VirtualServer::preStop(const std::string& reason) {
{
threads::MutexLock lock(this->stateLock);
if(!this->running() && this->state != ServerState::SUSPENDING) return;
@ -466,7 +466,7 @@ void TSServer::preStop(const std::string& reason) {
}
}
void TSServer::stop(const std::string& reason) {
void VirtualServer::stop(const std::string& reason) {
auto self_lock = this->self.lock();
assert(self_lock);
{
@ -532,7 +532,7 @@ void TSServer::stop(const std::string& reason) {
this->serverAdmin->server = nullptr;
}
size_t TSServer::onlineClients() {
size_t VirtualServer::onlineClients() {
size_t result = 0;
lock_guard lock(this->clients.lock);
@ -545,7 +545,7 @@ size_t TSServer::onlineClients() {
return result;
}
OnlineClientReport TSServer::onlineStats() {
OnlineClientReport VirtualServer::onlineStats() {
OnlineClientReport response{};
{
@ -575,7 +575,7 @@ OnlineClientReport TSServer::onlineStats() {
return response;
}
std::shared_ptr<ConnectedClient> TSServer::findClient(sockaddr_in *addr) {
std::shared_ptr<ConnectedClient> VirtualServer::findClient(sockaddr_in *addr) {
lock_guard lock(this->clients.lock);
for(const auto& elm : this->clients.clients) {
if(elm && elm->isAddressV4())
@ -586,7 +586,7 @@ std::shared_ptr<ConnectedClient> TSServer::findClient(sockaddr_in *addr) {
return nullptr;
}
std::shared_ptr<ConnectedClient> TSServer::findClient(uint16_t client_id) {
std::shared_ptr<ConnectedClient> VirtualServer::findClient(uint16_t client_id) {
lock_guard lock(this->clients.lock);
if(this->clients.clients.size() > client_id)
return this->clients.clients[client_id];
@ -594,7 +594,7 @@ std::shared_ptr<ConnectedClient> TSServer::findClient(uint16_t client_id) {
return nullptr;
}
deque<shared_ptr<ConnectedClient>> TSServer::findClientsByCldbId(uint64_t cldbId) {
deque<shared_ptr<ConnectedClient>> VirtualServer::findClientsByCldbId(uint64_t cldbId) {
deque<shared_ptr<ConnectedClient>> result;
lock_guard lock(this->clients.lock);
@ -607,7 +607,7 @@ deque<shared_ptr<ConnectedClient>> TSServer::findClientsByCldbId(uint64_t cldbId
return result;
}
deque<shared_ptr<ConnectedClient>> TSServer::findClientsByUid(std::string uid) {
deque<shared_ptr<ConnectedClient>> VirtualServer::findClientsByUid(std::string uid) {
lock_guard lock(this->clients.lock);
deque<shared_ptr<ConnectedClient>> result;
@ -621,7 +621,7 @@ deque<shared_ptr<ConnectedClient>> TSServer::findClientsByUid(std::string uid) {
return result;
}
std::shared_ptr<ConnectedClient> TSServer::findClient(std::string name, bool ignoreCase) {
std::shared_ptr<ConnectedClient> VirtualServer::findClient(std::string name, bool ignoreCase) {
if(ignoreCase) {
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
}
@ -645,7 +645,7 @@ std::shared_ptr<ConnectedClient> TSServer::findClient(std::string name, bool ign
return nullptr;
}
bool TSServer::forEachClient(std::function<void(std::shared_ptr<ConnectedClient>)> function) {
bool VirtualServer::forEachClient(std::function<void(std::shared_ptr<ConnectedClient>)> function) {
for(const auto& elm : this->getClients()) {
shared_lock close_lock(elm->finalDisconnectLock, try_to_lock_t{});
if(close_lock.owns_lock()) //If not locked than client is on the way to disconnect
@ -656,7 +656,7 @@ bool TSServer::forEachClient(std::function<void(std::shared_ptr<ConnectedClient>
return true;
}
std::vector<std::shared_ptr<ConnectedClient>> TSServer::getClients() {
std::vector<std::shared_ptr<ConnectedClient>> VirtualServer::getClients() {
vector<shared_ptr<ConnectedClient>> clients;
{
@ -672,7 +672,7 @@ std::vector<std::shared_ptr<ConnectedClient>> TSServer::getClients() {
return clients;
}
deque<shared_ptr<ConnectedClient>> TSServer::getClientsByChannel(std::shared_ptr<BasicChannel> channel) {
deque<shared_ptr<ConnectedClient>> VirtualServer::getClientsByChannel(std::shared_ptr<BasicChannel> channel) {
assert(this);
auto s_channel = dynamic_pointer_cast<ServerChannel>(channel);
@ -694,7 +694,7 @@ deque<shared_ptr<ConnectedClient>> TSServer::getClientsByChannel(std::shared_ptr
return result;
}
deque<shared_ptr<ConnectedClient>> TSServer::getClientsByChannelRoot(const std::shared_ptr<BasicChannel> &root, bool lock) {
deque<shared_ptr<ConnectedClient>> VirtualServer::getClientsByChannelRoot(const std::shared_ptr<BasicChannel> &root, bool lock) {
assert(this);
shared_lock channel_lock(this->channel_tree_lock, defer_lock);
@ -710,7 +710,7 @@ deque<shared_ptr<ConnectedClient>> TSServer::getClientsByChannelRoot(const std::
return result;
}
bool TSServer::notifyServerEdited(std::shared_ptr<ConnectedClient> invoker, deque<string> keys) {
bool VirtualServer::notifyServerEdited(std::shared_ptr<ConnectedClient> invoker, deque<string> keys) {
if(!invoker) return false;
Command cmd("notifyserveredited");
@ -733,7 +733,7 @@ bool TSServer::notifyServerEdited(std::shared_ptr<ConnectedClient> invoker, dequ
return true;
}
bool TSServer::notifyClientPropertyUpdates(std::shared_ptr<ConnectedClient> client, const deque<shared_ptr<property::PropertyDescription>>& keys, bool selfNotify) {
bool VirtualServer::notifyClientPropertyUpdates(std::shared_ptr<ConnectedClient> client, const deque<shared_ptr<property::PropertyDescription>>& keys, bool selfNotify) {
if(keys.empty()) return false;
this->forEachClient([&](const shared_ptr<ConnectedClient>& cl) {
shared_lock client_channel_lock(client->channel_lock);
@ -743,7 +743,7 @@ bool TSServer::notifyClientPropertyUpdates(std::shared_ptr<ConnectedClient> clie
return true;
}
void TSServer::broadcastMessage(std::shared_ptr<ConnectedClient> invoker, std::string message) {
void VirtualServer::broadcastMessage(std::shared_ptr<ConnectedClient> invoker, std::string message) {
if(!invoker) {
logCritical(this->serverId, "Tried to broadcast with an invalid invoker!");
return;
@ -753,7 +753,7 @@ void TSServer::broadcastMessage(std::shared_ptr<ConnectedClient> invoker, std::s
});
}
std::vector<std::shared_ptr<GroupAssignment>> CalculateCache::getGroupAssignments(TSServer* server, ClientDbId cldbid, ClientType type) {
std::vector<std::shared_ptr<GroupAssignment>> CalculateCache::getGroupAssignments(VirtualServer* server, ClientDbId cldbid, ClientType type) {
if(assignment_server_groups_set) return assignment_server_groups;
assignment_server_groups = server->getGroupManager()->getServerGroups(cldbid, type);
@ -761,7 +761,7 @@ std::vector<std::shared_ptr<GroupAssignment>> CalculateCache::getGroupAssignment
return assignment_server_groups;
}
std::shared_ptr<GroupAssignment> CalculateCache::getChannelAssignment(TSServer* server, ClientDbId client_dbid, ChannelId channel_id) {
std::shared_ptr<GroupAssignment> CalculateCache::getChannelAssignment(VirtualServer* server, ClientDbId client_dbid, ChannelId channel_id) {
if(this->assignment_channel_group_set && this->assignment_channel_group_channel == channel_id) return this->assignment_channel_group;
auto channel = this->getServerChannel(server, channel_id);
@ -771,7 +771,7 @@ std::shared_ptr<GroupAssignment> CalculateCache::getChannelAssignment(TSServer*
return assignment_channel_group;
}
std::shared_ptr<BasicChannel> CalculateCache::getServerChannel(ts::server::TSServer *server, ts::ChannelId channel_id) {
std::shared_ptr<BasicChannel> CalculateCache::getServerChannel(ts::server::VirtualServer *server, ts::ChannelId channel_id) {
if(this->last_server_channel == channel_id)
return this->server_channel;
this->last_server_channel = channel_id;
@ -783,7 +783,7 @@ ts_always_inline bool channel_ignore_permission(ts::permission::PermissionType t
return permission::i_icon_id == type;
}
vector<pair<ts::permission::PermissionType, ts::permission::v2::PermissionFlaggedValue>> TSServer::calculate_permissions(
vector<pair<ts::permission::PermissionType, ts::permission::v2::PermissionFlaggedValue>> VirtualServer::calculate_permissions(
const std::deque<permission::PermissionType>& permissions,
ClientDbId client_dbid,
ClientType client_type,
@ -1000,7 +1000,7 @@ vector<pair<ts::permission::PermissionType, ts::permission::v2::PermissionFlagge
return result;
}
permission::v2::PermissionFlaggedValue TSServer::calculate_permission(
permission::v2::PermissionFlaggedValue VirtualServer::calculate_permission(
permission::PermissionType permission,
ClientDbId cldbid,
ClientType type,
@ -1013,7 +1013,7 @@ permission::v2::PermissionFlaggedValue TSServer::calculate_permission(
return result.front().second;
}
bool TSServer::verifyServerPassword(std::string password, bool hashed) {
bool VirtualServer::verifyServerPassword(std::string password, bool hashed) {
if(!this->properties()[property::VIRTUALSERVER_FLAG_PASSWORD].as<bool>()) return true;
if(password.empty()) return false;
@ -1026,12 +1026,12 @@ bool TSServer::verifyServerPassword(std::string password, bool hashed) {
return password == this->properties()[property::VIRTUALSERVER_PASSWORD].as<std::string>();
}
float TSServer::averagePacketLoss() {
float VirtualServer::averagePacketLoss() {
//TODO Average packet loss
return 0.f;
}
float TSServer::averagePing() {
float VirtualServer::averagePing() {
float count = 0;
float sum = 0;
@ -1053,7 +1053,7 @@ float TSServer::averagePing() {
return sum / count;
}
bool TSServer::resetPermissions(std::string& token) {
bool VirtualServer::resetPermissions(std::string& token) {
LOG_SQL_CMD(sql::command(this->sql, "DELETE FROM `permissions` WHERE `serverId` = :serverId", variable{":serverId", this->serverId}).execute());
LOG_SQL_CMD(sql::command(this->sql, "DELETE FROM `assignedGroups` WHERE `serverId` = :serverId", variable{":serverId", this->serverId}).execute());
LOG_SQL_CMD(sql::command(this->sql, "DELETE FROM `groups` WHERE `serverId` = :serverId", variable{":serverId", this->serverId}).execute());
@ -1149,7 +1149,7 @@ bool TSServer::resetPermissions(std::string& token) {
return true;
}
void TSServer::ensureValidDefaultGroups() {
void VirtualServer::ensureValidDefaultGroups() {
auto default_server_group = this->getGroupManager()->defaultGroup(GROUPTARGET_SERVER, true);
if(!default_server_group) {
logError(this->serverId, "Missing server's default server group! (Id: {})", this->properties()[property::VIRTUALSERVER_DEFAULT_SERVER_GROUP].value());

View File

@ -117,12 +117,12 @@ namespace ts {
std::shared_ptr<BasicChannel> server_channel;
ChannelId last_server_channel = 0;
inline std::vector<std::shared_ptr<GroupAssignment>> getGroupAssignments(TSServer* server, ClientDbId cldbid, ClientType type);
inline std::shared_ptr<GroupAssignment> getChannelAssignment(TSServer* server, ClientDbId client_dbid, ChannelId channel);
inline std::shared_ptr<BasicChannel> getServerChannel(TSServer*, ChannelId);
inline std::vector<std::shared_ptr<GroupAssignment>> getGroupAssignments(VirtualServer* server, ClientDbId cldbid, ClientType type);
inline std::shared_ptr<GroupAssignment> getChannelAssignment(VirtualServer* server, ClientDbId client_dbid, ChannelId channel);
inline std::shared_ptr<BasicChannel> getServerChannel(VirtualServer*, ChannelId);
};
class TSServer {
class VirtualServer {
friend class WebClient;
friend class DataClient;
friend class VoiceClient;
@ -136,8 +136,8 @@ namespace ts {
friend class InstanceHandler;
friend class ServerManager;
public:
TSServer(ServerId serverId, sql::SqlManager*);
~TSServer();
VirtualServer(ServerId serverId, sql::SqlManager*);
~VirtualServer();
bool initialize(bool test_properties);
@ -241,7 +241,7 @@ namespace ts {
bool could_default_create_channel();
inline std::shared_ptr<TSServer> ref() { return this->self.lock(); }
inline std::shared_ptr<VirtualServer> ref() { return this->self.lock(); }
inline bool disable_ip_saving() { return this->_disable_ip_saving; }
inline std::chrono::system_clock::time_point start_timestamp() { return this->startTimestamp; };
@ -279,7 +279,7 @@ namespace ts {
bool assignDefaultChannel(const std::shared_ptr<ConnectedClient>&, bool join);
private:
std::weak_ptr<TSServer> self;
std::weak_ptr<VirtualServer> self;
//Locks by tick, start and stop
threads::Mutex stateLock;

View File

@ -3,7 +3,7 @@
#include <misc/memtracker.h>
#include <misc/sassert.h>
#include "misc/rnd.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "src/client/ConnectedClient.h"
#include "src/server/file/FileServer.h"
#include "src/InstanceHandler.h"
@ -60,7 +60,7 @@ void ServerChannel::setProperties(const std::shared_ptr<Properties> &ptr) {
BasicChannel::setProperties(ptr);
}
ServerChannelTree::ServerChannelTree(const std::shared_ptr<server::TSServer>& server, sql::SqlManager* sql) : sql(sql), server(server) { }
ServerChannelTree::ServerChannelTree(const std::shared_ptr<server::VirtualServer>& server, sql::SqlManager* sql) : sql(sql), server(server) { }
ServerChannelTree::~ServerChannelTree() { }

View File

@ -11,7 +11,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class ConnectedClient;
}
@ -36,7 +36,7 @@ namespace ts {
class ServerChannelTree : public BasicChannelTree {
public:
ServerChannelTree(const std::shared_ptr<server::TSServer>&, sql::SqlManager*);
ServerChannelTree(const std::shared_ptr<server::VirtualServer>&, sql::SqlManager*);
virtual ~ServerChannelTree();
void loadChannelsFromDatabase();
@ -54,7 +54,7 @@ namespace ts {
std::shared_ptr<BasicChannel> allocateChannel(const std::shared_ptr<BasicChannel> &parent, ChannelId channelId) override;
private:
std::weak_ptr<server::TSServer> server;
std::weak_ptr<server::VirtualServer> server;
ServerId getServerId();
sql::SqlManager* sql;

View File

@ -8,7 +8,7 @@
#include <log/LogUtils.h>
#include <ThreadPool/Timer.h>
#include "../TSServer.h"
#include "src/VirtualServer.h"
#include "voice/VoiceClient.h"
#include "../server/VoiceServer.h"
#include "../server/file/FileServer.h"
@ -23,7 +23,7 @@ using namespace ts::token;
extern ts::server::InstanceHandler* serverInstance;
ConnectedClient::ConnectedClient(sql::SqlManager* db, const std::shared_ptr<TSServer>&server) : DataClient(db, server) {
ConnectedClient::ConnectedClient(sql::SqlManager* db, const std::shared_ptr<VirtualServer>&server) : DataClient(db, server) {
memtrack::allocated<ConnectedClient>(this);
memset(&this->remote_address, 0, sizeof(this->remote_address));
@ -83,7 +83,7 @@ std::shared_ptr<ConnectionInfoData> ConnectedClient::request_connection_info(con
//Attention the client should be only read only locked!
void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool notify_self) {
/* this->server may be null! */
shared_ptr<TSServer> server_ref = this->server;
shared_ptr<VirtualServer> server_ref = this->server;
auto permissions = this->calculate_permissions({
permission::i_client_talk_power,

View File

@ -16,7 +16,7 @@ if(!this->server) return command_result{error::server_invalid_id};
/* TODO: Play lock the server here with read? So the client dosn't get kicked within that moment */
#define CMD_REF_SERVER(variable_name) \
std::shared_ptr<TSServer> variable_name = this->getServer(); \
std::shared_ptr<VirtualServer> variable_name = this->getServer(); \
if(!variable_name) return command_result{error::server_invalid_id};
#define CMD_REQ_CHANNEL \
@ -45,7 +45,7 @@ namespace ts {
}
namespace server {
class TSServer;
class VirtualServer;
class MusicClient;
class WebClient;
class MusicClient;
@ -56,7 +56,7 @@ namespace ts {
};
class ConnectedClient : public DataClient {
friend class TSServer;
friend class VirtualServer;
friend class VoiceServer;
friend class VoiceClient;
friend class MusicClient;
@ -70,7 +70,7 @@ namespace ts {
friend class ts::GroupManager;
friend class ServerManager;
public:
explicit ConnectedClient(sql::SqlManager*, const std::shared_ptr<TSServer>& server);
explicit ConnectedClient(sql::SqlManager*, const std::shared_ptr<VirtualServer>& server);
~ConnectedClient() override;
ConnectionState connectionState(){ return this->state; }
@ -96,7 +96,7 @@ namespace ts {
inline std::shared_ptr<BasicChannel> getChannel(){ return this->currentChannel; }
inline ChannelId getChannelId(){ auto channel = this->currentChannel; return channel ? channel->channelId() : 0; }
inline std::shared_ptr<TSServer> getServer(){ return this->server; }
inline std::shared_ptr<VirtualServer> getServer(){ return this->server; }
inline ServerId getServerId(){ return this->server ? this->server->getServerId() : (ServerId) 0; }
//bool channelSubscribed(const std::shared_ptr<BasicChannel>&);

View File

@ -13,7 +13,7 @@ using namespace ts;
using namespace ts::server;
using namespace ts::permission;
DataClient::DataClient(sql::SqlManager* database, const std::shared_ptr<TSServer>& server) : server(server), sql(database) {
DataClient::DataClient(sql::SqlManager* database, const std::shared_ptr<VirtualServer>& server) : server(server), sql(database) {
assert(database);
this->_properties = DatabaseHelper::default_properties_client(nullptr, ClientType::CLIENT_INTERNAL);
}

View File

@ -7,7 +7,7 @@
#include <BasicChannel.h>
#include <Error.h>
#include <netinet/in.h>
#include "../TSServer.h"
#include "src/VirtualServer.h"
#include "../Group.h"
#define DEBUG_PERMISSION
@ -17,10 +17,10 @@ namespace ts {
class MusicBotManager;
}
namespace server {
class TSServer;
class VirtualServer;
class DataClient {
friend class TSServer;
friend class VirtualServer;
friend class QueryServer;
friend class music::MusicBotManager;
public:
@ -51,7 +51,7 @@ namespace ts {
}
};
DataClient(sql::SqlManager*, const std::shared_ptr<TSServer>&);
DataClient(sql::SqlManager*, const std::shared_ptr<VirtualServer>&);
virtual ~DataClient();
@ -100,7 +100,7 @@ namespace ts {
virtual bool loadDataForCurrentServer();
protected:
sql::SqlManager* sql;
std::shared_ptr<TSServer> server;
std::shared_ptr<VirtualServer> server;
std::shared_ptr<permission::v2::PermissionManager> clientPermissions = nullptr;
std::shared_ptr<Properties> _properties;

View File

@ -6,7 +6,7 @@ using namespace std;
using namespace ts;
using namespace ts::server;
InternalClient::InternalClient(sql::SqlManager* sql,const std::shared_ptr<server::TSServer>& handle, std::string displayName, bool generalClient) : ConnectedClient(sql, handle) {
InternalClient::InternalClient(sql::SqlManager* sql,const std::shared_ptr<server::VirtualServer>& handle, std::string displayName, bool generalClient) : ConnectedClient(sql, handle) {
memtrack::allocated<InternalClient>(this);
this->properties()[property::CLIENT_TYPE] = ClientType::CLIENT_INTERNAL;
this->properties()[property::CLIENT_TYPE_EXACT] = ClientType::CLIENT_INTERNAL;

View File

@ -6,7 +6,7 @@ namespace ts {
namespace server {
class InternalClient : public ConnectedClient {
public:
InternalClient(sql::SqlManager*, const std::shared_ptr<server::TSServer>&, std::string, bool);
InternalClient(sql::SqlManager*, const std::shared_ptr<server::VirtualServer>&, std::string, bool);
~InternalClient();
void setSharedLock(const std::shared_ptr<ConnectedClient>& _this){

View File

@ -5,7 +5,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class SpeakingClient : public ConnectedClient {
public:
struct VoicePacketFlags {
@ -32,7 +32,7 @@ namespace ts {
UNSET = 0xff
};
SpeakingClient(sql::SqlManager* a, const std::shared_ptr<TSServer>& b) : ConnectedClient(a, b) {
SpeakingClient(sql::SqlManager* a, const std::shared_ptr<VirtualServer>& b) : ConnectedClient(a, b) {
speak_begin = std::chrono::system_clock::now();
speak_last_packet = std::chrono::system_clock::now();
};

View File

@ -242,7 +242,7 @@ command_result ConnectedClient::handleCommandChannelGroupCopy(Command &cmd) {
global_update = !this->server || !group_manager->isLocalGroup(group_manager->findGroup(target_group_id));
}
for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque<shared_ptr<TSServer>>{this->server}))
for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque<shared_ptr<VirtualServer>>{this->server}))
if(server)
server->forEachClient([](shared_ptr<ConnectedClient> cl) {
cl->notifyChannelGroupList();

View File

@ -293,7 +293,7 @@ inline void cmd_filelist_append_files(ServerId sid, Command &command, vector<std
//pattern=%asd%
struct ClientDbArgs {
shared_ptr<TSServer> server;
shared_ptr<VirtualServer> server;
int index = 0;
int offset = 0;
int resultIndex = 0;

View File

@ -718,7 +718,7 @@ command_result ConnectedClient::handleCommandBanAdd(Command &cmd) {
}
if(!banned) serverInstance->banManager()->registerBan(sid, this->getClientDatabaseId(), banreason, uid, ip, name, hwid, until);
for(auto server : (this->server ? std::deque<shared_ptr<TSServer>>{this->server} : serverInstance->getVoiceServerManager()->serverInstances()))
for(auto server : (this->server ? std::deque<shared_ptr<VirtualServer>>{this->server} : serverInstance->getVoiceServerManager()->serverInstances()))
server->testBanStateChange(_this.lock());
return command_result{error::ok};
}

View File

@ -419,7 +419,7 @@ command_result ConnectedClient::handleCommandServerGroupCopy(Command &cmd) {
global_update = !this->server || !group_manager->isLocalGroup(group_manager->findGroup(target_group_id));
}
for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque<shared_ptr<TSServer>>{this->server}))
for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque<shared_ptr<VirtualServer>>{this->server}))
if(server)
server->forEachClient([](shared_ptr<ConnectedClient> cl) {
cl->notifyServerGroupList();
@ -622,7 +622,7 @@ command_result ConnectedClient::handleCommandServerGroupAddClient(Command &cmd)
}
}
for(const auto& _server : target_server ? std::deque<shared_ptr<TSServer>>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) {
for(const auto& _server : target_server ? std::deque<shared_ptr<VirtualServer>>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) {
for (const auto &targetClient : _server->findClientsByCldbId(target_cldbid)) {
if (_server->notifyClientPropertyUpdates(targetClient, _server->groups->update_server_group_property(targetClient, true, targetClient->getChannel()))) {
for (const auto &client : _server->getClients()) {
@ -749,7 +749,7 @@ command_result ConnectedClient::handleCommandServerGroupDelClient(Command &cmd)
}
}
for(const auto& _server : target_server ? std::deque<shared_ptr<TSServer>>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) {
for(const auto& _server : target_server ? std::deque<shared_ptr<VirtualServer>>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) {
for (const auto &targetClient : _server->findClientsByCldbId(target_cldbid)) {
if (_server->notifyClientPropertyUpdates(targetClient, _server->groups->update_server_group_property(targetClient, true, targetClient->getChannel()))) {
for (const auto &client : _server->getClients()) {

View File

@ -7,7 +7,7 @@
#include <event.h>
#include <pipes/ws.h>
#include <pipes/ssl.h>
#include "../../TSServer.h"
#include "src/VirtualServer.h"
namespace ts {
namespace server {

View File

@ -24,14 +24,14 @@ MusicClient::loader_t MusicClient::channelLoader() {
}
MusicClient::loader_t MusicClient::failedLoader(const std::string &message) {
return make_shared<music::PlayableSong::song_loader_t>([message] (const shared_ptr<TSServer>, const shared_ptr<music::PlayableSong>&, std::string& error) mutable -> std::shared_ptr<music::PlayableSong::LoadedData> {
return make_shared<music::PlayableSong::song_loader_t>([message] (const shared_ptr<VirtualServer>, const shared_ptr<music::PlayableSong>&, std::string& error) mutable -> std::shared_ptr<music::PlayableSong::LoadedData> {
error = message;
return nullptr;
});
}
MusicClient::loader_t MusicClient::providerLoader(const std::string &name, shared_ptr<::music::manager::PlayerProvider> provider) {
return make_shared<music::PlayableSong::song_loader_t>([name, provider, used_provider = std::move(provider)] (const shared_ptr<TSServer> server, const shared_ptr<music::PlayableSong>& entry, std::string& error) mutable -> std::shared_ptr<music::PlayableSong::LoadedData> {
return make_shared<music::PlayableSong::song_loader_t>([name, provider, used_provider = std::move(provider)] (const shared_ptr<VirtualServer> server, const shared_ptr<music::PlayableSong>& entry, std::string& error) mutable -> std::shared_ptr<music::PlayableSong::LoadedData> {
if(!used_provider)
used_provider = ::music::manager::resolveProvider(name, entry->getUrl());
@ -69,7 +69,7 @@ MusicClient::loader_t MusicClient::providerLoader(const std::string &name, share
});
}
MusicClient::MusicClient(const std::shared_ptr<TSServer>& handle, const std::string& uniqueId) : ConnectedClient(handle->getSql(), handle) {
MusicClient::MusicClient(const std::shared_ptr<VirtualServer>& handle, const std::string& uniqueId) : ConnectedClient(handle->getSql(), handle) {
memtrack::allocated<MusicClient>(this);
this->state = CONNECTED;
this->properties()[property::CLIENT_TYPE] = ClientType::CLIENT_TEAMSPEAK;

View File

@ -44,7 +44,7 @@ namespace ts {
STOPPED
};
MusicClient(const std::shared_ptr<TSServer>&,const std::string&);
MusicClient(const std::shared_ptr<VirtualServer>&,const std::string&);
virtual ~MusicClient() override;
void setSharedLock(const std::shared_ptr<ConnectedClient> &_this){

View File

@ -11,7 +11,7 @@ using namespace std::chrono;
PlayableSong::~PlayableSong() = default;
shared_ptr<PlayableSong::song_future_t> PlayableSong::get_loader(const std::shared_ptr<server::TSServer>& server, bool spawn_new) {
shared_ptr<PlayableSong::song_future_t> PlayableSong::get_loader(const std::shared_ptr<server::VirtualServer>& server, bool spawn_new) {
if(!spawn_new || this->_loader_future) return this->_loader_future;
this->_loader_future = make_shared<PlayableSong::song_future_t>();

View File

@ -9,7 +9,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
}
namespace music {
@ -39,7 +39,7 @@ namespace ts {
std::shared_ptr<MusicPlayer> player;
};
typedef std::function<std::shared_ptr<LoadedData>(const std::shared_ptr<server::TSServer>& /* server */, const std::shared_ptr<PlayableSong>& entry, std::string& error)> song_loader_t;
typedef std::function<std::shared_ptr<LoadedData>(const std::shared_ptr<server::VirtualServer>& /* server */, const std::shared_ptr<PlayableSong>& entry, std::string& error)> song_loader_t;
typedef threads::Future<std::shared_ptr<LoadedData>> song_future_t;
public:
@ -56,7 +56,7 @@ namespace ts {
virtual ~PlayableSong();
inline std::shared_ptr<song_loader_t> song_loader() { return this->_loader_function; }
std::shared_ptr<song_future_t> get_loader(const std::shared_ptr<server::TSServer>&, bool /* create if not exists */ = true);
std::shared_ptr<song_future_t> get_loader(const std::shared_ptr<server::VirtualServer>&, bool /* create if not exists */ = true);
inline std::shared_ptr<MusicPlayer> get_player() {
auto data = this->song_loaded_data();
if(!data) return nullptr;

View File

@ -21,7 +21,7 @@ struct AudioFileInfo {
extern ts::server::InstanceHandler* serverInstance;
threads::Future<std::shared_ptr<::music::MusicPlayer>> ChannelProvider::createPlayer(const std::string &url, void*, void* ptr_server) {
auto server = ((TSServer*) ptr_server)->ref();
auto server = ((VirtualServer*) ptr_server)->ref();
threads::Future<std::shared_ptr<::music::MusicPlayer>> future;
if(server) {

View File

@ -290,7 +290,7 @@ command_result QueryClient::handleCommandLogout(Command &) {
command_result QueryClient::handleCommandServerSelect(Command &cmd) {
CMD_RESET_IDLE;
shared_ptr<TSServer> target;
shared_ptr<VirtualServer> target;
if(cmd[0].has("port")){
target = serverInstance->getVoiceServerManager()->findServerByPort(cmd["port"].as<uint16_t>());
@ -581,7 +581,7 @@ command_result QueryClient::handleCommandServerCreate(Command& cmd) {
}
string startError;
shared_ptr<TSServer> server;
shared_ptr<VirtualServer> server;
milliseconds time_create, time_wait, time_start, time_global;
{

View File

@ -8,7 +8,7 @@
#include <log/LogUtils.h>
#include "VoiceClient.h"
#include "../../TSServer.h"
#include "src/VirtualServer.h"
#include "../../server/VoiceServer.h"
using namespace std;

View File

@ -37,10 +37,10 @@ namespace ts {
class VoiceClientConnection;
}
namespace server {
class TSServer;
class VirtualServer;
class VoiceClient : public SpeakingClient {
friend class TSServer;
friend class VirtualServer;
friend class VoiceServer;
friend class POWHandler;
friend class ts::connection::VoiceClientConnection;

View File

@ -2,7 +2,7 @@
#include <utility>
#include <log/LogUtils.h>
#include "BanManager.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "src/client/ConnectedClient.h"
using namespace std;

View File

@ -24,7 +24,7 @@ DEFINE_VARIABLE_TRANSFORM(ts::server::BanStringType, VARTYPE_INT, std::to_string
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class ConnectedClient;
struct BanRecord {

View File

@ -1,13 +1,13 @@
#include <algorithm>
#include <log/LogUtils.h>
#include "ComplainManager.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
using namespace std;
using namespace std::chrono;
using namespace ts;
ComplainManager::ComplainManager(server::TSServer* server) : server(server) { }
ComplainManager::ComplainManager(server::VirtualServer* server) : server(server) { }
ComplainManager::~ComplainManager() {
this->entries.clear();
}

View File

@ -6,7 +6,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
}
struct ComplainEntry;
}
@ -21,7 +21,7 @@ namespace ts {
class ComplainManager {
public:
ComplainManager(server::TSServer*);
ComplainManager(server::VirtualServer*);
~ComplainManager();
bool loadComplains();
@ -36,7 +36,7 @@ namespace ts {
std::shared_ptr<ComplainEntry> createComplain(ClientDbId target, ClientDbId reporter, std::string msg);
private:
server::TSServer* server;
server::VirtualServer* server;
threads::Mutex entryLock;
std::deque<std::shared_ptr<ComplainEntry>> entries;
};

View File

@ -2,7 +2,7 @@
#include "./ConversationManager.h"
#include "../InstanceHandler.h"
#include "../TSServer.h"
#include "src/VirtualServer.h"
#include <experimental/filesystem>
#include <log/LogUtils.h>
@ -1257,7 +1257,7 @@ size_t Conversation::delete_messages(const std::chrono::system_clock::time_point
return max(delete_count, delete_count_volatile);
}
ConversationManager::ConversationManager(const std::shared_ptr<ts::server::TSServer> &server) : _ref_server(server) { }
ConversationManager::ConversationManager(const std::shared_ptr<ts::server::VirtualServer> &server) : _ref_server(server) { }
ConversationManager::~ConversationManager() { }

View File

@ -11,7 +11,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
namespace conversation {
struct ConversationEntry {
std::chrono::system_clock::time_point message_timestamp;
@ -222,7 +222,7 @@ namespace ts {
class ConversationManager {
public:
ConversationManager(const std::shared_ptr<TSServer>& /* server */);
ConversationManager(const std::shared_ptr<VirtualServer>& /* server */);
virtual ~ConversationManager();
void initialize(const std::shared_ptr<ConversationManager>& _this);
@ -239,12 +239,12 @@ namespace ts {
return this->_conversations;
}
ts_always_inline std::shared_ptr<TSServer> ref_server() {
ts_always_inline std::shared_ptr<VirtualServer> ref_server() {
return this->_ref_server.lock();
}
private:
std::weak_ptr<ConversationManager> _ref_this;
std::weak_ptr<TSServer> _ref_server;
std::weak_ptr<VirtualServer> _ref_server;
std::mutex _conversations_lock;
std::deque<std::shared_ptr<Conversation>> _conversations;

View File

@ -1,7 +1,7 @@
#include <sql/SqlQuery.h>
#include <log/LogUtils.h>
#include "LetterManager.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
using namespace std;
using namespace std::chrono;
@ -11,7 +11,7 @@ using namespace ts::server;
//`serverId` INT NOT NULL, `sender` TEXT, `receiver` TEXT, `created` INT, `subject` TEXT, `message` TEXT
LetterManager::LetterManager(server::TSServer* server) : server(server) {}
LetterManager::LetterManager(server::VirtualServer* server) : server(server) {}
LetterManager::~LetterManager() {}
size_t LetterManager::unread_letter_count(const ts::ClientUid &client_unique_id) {

View File

@ -6,7 +6,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
}
@ -26,7 +26,7 @@ namespace ts {
class LetterManager {
public:
LetterManager(server::TSServer*);
LetterManager(server::VirtualServer*);
~LetterManager();
@ -39,7 +39,7 @@ namespace ts {
void createLetter(ClientUid sender, ClientUid reciver, std::string subject, std::string message);
private:
server::TSServer* server;
server::VirtualServer* server;
};
}
}

View File

@ -9,7 +9,7 @@
#include <misc/rnd.h>
#include <log/LogUtils.h>
#include "TokeManager.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
using namespace std;
using namespace std::chrono;
@ -17,7 +17,7 @@ using namespace ts;
using namespace ts::server;
using namespace ts::token;
TokenManager::TokenManager(server::TSServer* handle) : handle(handle) {
TokenManager::TokenManager(server::VirtualServer* handle) : handle(handle) {
}

View File

@ -8,7 +8,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
}
namespace token {
@ -29,7 +29,7 @@ namespace ts {
class TokenManager {
public:
TokenManager(server::TSServer*);
TokenManager(server::VirtualServer*);
~TokenManager();
bool loadTokens();
@ -39,7 +39,7 @@ namespace ts {
bool deleteToke(const std::string&);
private:
int loadTokenFromDb(int length, char** values, char** columns);
server::TSServer* handle;
server::VirtualServer* handle;
std::vector<std::shared_ptr<TokenEntry>> tokens;
};
}

View File

@ -1,4 +1,4 @@
#include <src/TSServer.h>
#include <src/VirtualServer.h>
#include <misc/rnd.h>
#include <misc/digest.h>
#include <misc/base64.h>
@ -31,7 +31,7 @@ void MusicBotManager::shutdown() {
load_music.shutdown();
}
MusicBotManager::MusicBotManager(const shared_ptr<server::TSServer>& server) : handle(server) { }
MusicBotManager::MusicBotManager(const shared_ptr<server::VirtualServer>& server) : handle(server) { }
MusicBotManager::~MusicBotManager() { }

View File

@ -9,14 +9,14 @@
namespace ts {
namespace server {
class MusicClient;
class TSServer;
class VirtualServer;
}
namespace music {
class PlayablePlaylist;
class MusicBotManager {
friend class server::TSServer;
friend class server::VirtualServer;
friend class server::MusicClient;
public:
static threads::ThreadPool tick_music;
@ -25,7 +25,7 @@ namespace ts {
static void adjustTickPool();
MusicBotManager(const std::shared_ptr<server::TSServer>&);
MusicBotManager(const std::shared_ptr<server::VirtualServer>&);
~MusicBotManager();
void load_bots();
@ -57,12 +57,12 @@ namespace ts {
std::shared_ptr<PlayablePlaylist> create_playlist(ClientDbId /* owner */, const std::string& /* owner name */);
bool delete_playlist(PlaylistId /* id */, std::string& /* error */);
inline std::shared_ptr<server::TSServer> ref_server() { return this->handle.lock(); }
inline std::shared_ptr<server::VirtualServer> ref_server() { return this->handle.lock(); }
inline std::shared_ptr<MusicBotManager> ref() { return this->_self.lock(); }
private:
std::weak_ptr<MusicBotManager> _self;
std::weak_ptr<server::TSServer> handle;
std::weak_ptr<server::VirtualServer> handle;
int sqlCreateMusicBot(int, std::string*, std::string*);
std::recursive_mutex music_bots_lock;

View File

@ -1,7 +1,7 @@
#include <linked_helper.h>
#include <json/json.h>
#include "MusicPlaylist.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "src/client/ConnectedClient.h"
#include <log/LogUtils.h>
#include "src/client/music/internal_provider/channel_replay/ChannelProvider.h"
@ -23,7 +23,7 @@ void Playlist::set_self_ref(const std::shared_ptr<ts::music::Playlist> &ref) {
this->_self = ref;
}
std::shared_ptr<server::TSServer> Playlist::get_server() {
std::shared_ptr<server::VirtualServer> Playlist::get_server() {
auto handle = this->ref_handle();
if(!handle) return nullptr;
return handle->ref_server();

View File

@ -119,7 +119,7 @@ namespace ts {
bool _songs_loaded = false;
sql::SqlManager* get_sql();
std::shared_ptr<server::TSServer> get_server();
std::shared_ptr<server::VirtualServer> get_server();
ServerId get_server_id();
std::shared_mutex playlist_lock;

View File

@ -1,5 +1,5 @@
#include "PlayablePlaylist.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "src/client/music/MusicClient.h"
#include "src/client/ConnectedClient.h"
#include <log/LogUtils.h>

View File

@ -6,7 +6,7 @@
#include <src/client/voice/PrecomputedPuzzles.h>
#include <Definitions.h>
#include "VoiceServer.h"
#include "src/TSServer.h"
#include "src/VirtualServer.h"
namespace ts {
namespace server {

View File

@ -6,7 +6,7 @@
#include <algorithm>
#include <netinet/tcp.h>
#include <poll.h>
#include <src/TSServer.h>
#include <src/VirtualServer.h>
#include <src/client/query/QueryClient.h>
#include <src/client/InternalClient.h>
#include <misc/rnd.h>

View File

@ -20,7 +20,7 @@ namespace ts {
class Group;
namespace server {
class TSServer;
class VirtualServer;
class QueryClient;
struct QueryLoginCredentials {

View File

@ -1,7 +1,7 @@
#include <event.h>
#include <algorithm>
#include <log/LogUtils.h>
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "VoiceIOManager.h"
#include "VoiceServer.h"
#include "src/client/voice/VoiceClient.h"
@ -17,7 +17,7 @@ VoiceIOManager::VoiceIOManager(){ }
VoiceIOManager::~VoiceIOManager() { }
std::shared_ptr<IOServerHandler> VoiceIOManager::enableIo(server::TSServer *server) {
std::shared_ptr<IOServerHandler> VoiceIOManager::enableIo(server::VirtualServer *server) {
auto server_io = std::make_shared<IOServerHandler>(server);
this->adjustExecutors(this->servers.size() + 1);
@ -43,7 +43,7 @@ std::shared_ptr<IOServerHandler> VoiceIOManager::enableIo(server::TSServer *serv
return server_io;
}
void VoiceIOManager::disableIo(server::TSServer* server) {
void VoiceIOManager::disableIo(server::VirtualServer* server) {
std::shared_ptr<IOServerHandler> server_io;
{
threads::MutexLock l(this->serverLock);
@ -192,7 +192,7 @@ std::shared_ptr<IOEventLoop> VoiceIOManager::less_used_io_loop(vector<shared_ptr
return current;
}
IOServerHandler::IOServerHandler(server::TSServer* server) : server(server) { }
IOServerHandler::IOServerHandler(server::VirtualServer* server) : server(server) { }
IOServerHandler::~IOServerHandler() {
for(const auto& entry : this->event_loop_events) {

View File

@ -9,7 +9,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class VoiceServer;
class VoiceClient;
}
@ -72,7 +72,7 @@ namespace ts {
sa_family_t family;
/* keeps these addresses in "hot" memory instead resolving three ptr */
server::TSServer* server;
server::VirtualServer* server;
server::VoiceServer* voice_server;
int file_descriptor = 0; /* actual socket */
@ -187,7 +187,7 @@ namespace ts {
friend class VoiceIOManager;
friend struct IOEventLoopEvents;
public:
explicit IOServerHandler(server::TSServer*);
explicit IOServerHandler(server::VirtualServer*);
~IOServerHandler();
void invoke_write(const std::shared_ptr<server::VoiceClient>& /* client */);
@ -196,7 +196,7 @@ namespace ts {
private:
std::shared_ptr<IOEventLoopEvents> create_event_loop_events(const std::shared_ptr<IOEventLoop> &);
server::TSServer* server = nullptr;
server::VirtualServer* server = nullptr;
std::deque<std::shared_ptr<IOEventLoopEvents>> event_loop_events;
size_t event_loop_index = 0;
};
@ -206,8 +206,8 @@ namespace ts {
VoiceIOManager();
virtual ~VoiceIOManager();
std::shared_ptr<IOServerHandler> enableIo(server::TSServer* server);
void disableIo(server::TSServer*);
std::shared_ptr<IOServerHandler> enableIo(server::VirtualServer* server);
void disableIo(server::VirtualServer*);
void shutdownGlobally();
private:

View File

@ -8,7 +8,7 @@
#include "../client/voice/VoiceClient.h"
#include "../Configuration.h"
#include <log/LogUtils.h>
#include "../TSServer.h"
#include "src/VirtualServer.h"
#include <misc/endianness.h>
#include "../ServerManager.h"
#include "../InstanceHandler.h"
@ -26,7 +26,7 @@ using namespace ts;
extern InstanceHandler* serverInstance;
VoiceServer::VoiceServer(const std::shared_ptr<TSServer>& server) {
VoiceServer::VoiceServer(const std::shared_ptr<VirtualServer>& server) {
this->server = server;
this->pow_handler = make_unique<POWHandler>(this);
}

View File

@ -16,7 +16,7 @@ namespace ts {
}
namespace server {
class TSServer;
class VirtualServer;
class ConnectedClient;
class VoiceClient;
class POWHandler;
@ -35,7 +35,7 @@ namespace ts {
friend struct io::IOEventLoopEvents;
friend class POWHandler;
public:
explicit VoiceServer(const std::shared_ptr<TSServer>& server);
explicit VoiceServer(const std::shared_ptr<VirtualServer>& server);
~VoiceServer();
bool start(const std::deque<std::shared_ptr<VoiceServerBinding>>&, std::string&);
@ -60,10 +60,10 @@ namespace ts {
return result;
}
inline std::shared_ptr<TSServer> get_server() { return this->server; }
inline std::shared_ptr<VirtualServer> get_server() { return this->server; }
private:
std::unique_ptr<POWHandler> pow_handler;
std::shared_ptr<TSServer> server = nullptr;
std::shared_ptr<VirtualServer> server = nullptr;
bool running = false;
std::deque<std::shared_ptr<VoiceServerBinding>> bindings;

View File

@ -15,7 +15,7 @@ using namespace ts::server;
#define TCP_NOPUSH TCP_CORK
#endif
WebControlServer::WebControlServer(const std::shared_ptr<TSServer>& handle) : handle(handle) {}
WebControlServer::WebControlServer(const std::shared_ptr<VirtualServer>& handle) : handle(handle) {}
WebControlServer::~WebControlServer() = default;
bool WebControlServer::start(const std::deque<std::shared_ptr<WebControlServer::Binding>>& bindings, std::string& error) {

View File

@ -7,7 +7,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class WebClient;
class WebControlServer {
@ -21,14 +21,14 @@ namespace ts {
inline std::string as_string() { return net::to_string(address, true); }
};
explicit WebControlServer(const std::shared_ptr<TSServer>&);
explicit WebControlServer(const std::shared_ptr<VirtualServer>&);
~WebControlServer();
bool start(const std::deque<std::shared_ptr<Binding>>& /* bindings */, std::string& /* error */);
inline bool running(){ return _running; }
void stop();
std::shared_ptr<TSServer> getTS(){ return this->handle; }
std::shared_ptr<VirtualServer> getTS(){ return this->handle; }
std::deque<std::shared_ptr<WebClient>> connectedClients(){
threads::MutexLock l(this->clientLock);
@ -36,7 +36,7 @@ namespace ts {
}
private:
std::shared_ptr<TSServer> handle = nullptr;
std::shared_ptr<VirtualServer> handle = nullptr;
threads::Mutex clientLock;
std::deque<std::shared_ptr<WebClient>> clients;

View File

@ -211,7 +211,7 @@ std::shared_ptr<file::FileTransfereKey> FileServer::generateUploadTransferKey(st
return result;
}
std::shared_ptr<file::Directory> FileServer::resolveDirectory(const shared_ptr<TSServer> &server, std::shared_ptr<BasicChannel> channel, std::string subPath) {
std::shared_ptr<file::Directory> FileServer::resolveDirectory(const shared_ptr<VirtualServer> &server, std::shared_ptr<BasicChannel> channel, std::string subPath) {
fs::path path = fs::u8path("server_" + to_string(server ? server->getServerId() : 0) + "/channel_" + to_string(channel->channelId()));
if(!findFile(path))
this->createDirectory(path.string(), nullptr);
@ -222,7 +222,7 @@ std::shared_ptr<file::Directory> FileServer::resolveDirectory(const shared_ptr<T
return static_pointer_cast<file::Directory>(ffile);
}
std::shared_ptr<file::Directory> FileServer::iconDirectory(const shared_ptr<TSServer> &server) {
std::shared_ptr<file::Directory> FileServer::iconDirectory(const shared_ptr<VirtualServer> &server) {
fs::path root = fs::u8path(this->rootPath);
fs::path path = fs::u8path("server_" + to_string(server ? server->getServerId() : 0) + "/icons");
if(!fs::exists(root / path)) {
@ -232,13 +232,13 @@ std::shared_ptr<file::Directory> FileServer::iconDirectory(const shared_ptr<TSSe
return static_pointer_cast<file::Directory>(findFile(path.string()));
}
bool FileServer::iconExists(const shared_ptr<TSServer> &server, IconId icon) {
bool FileServer::iconExists(const shared_ptr<VirtualServer> &server, IconId icon) {
if(icon == 0) return false;
if(icon < 1000) return true;
return this->findFile("icon_" + to_string(icon), this->iconDirectory(server)) != nullptr;
}
std::shared_ptr<file::Directory> FileServer::avatarDirectory(const shared_ptr<TSServer> &server) {
std::shared_ptr<file::Directory> FileServer::avatarDirectory(const shared_ptr<VirtualServer> &server) {
fs::path path = fs::u8path("server_" + to_string(server ? server->getServerId() : 0) + "/avatars");
if(!findFile(path))
this->createDirectory(path.string(), nullptr);
@ -246,7 +246,7 @@ std::shared_ptr<file::Directory> FileServer::avatarDirectory(const shared_ptr<TS
}
#define TS3_ICON_HASH "icon_1001"
void FileServer::setupServer(const shared_ptr<TSServer> &server) {
void FileServer::setupServer(const shared_ptr<VirtualServer> &server) {
auto dir = iconDirectory(server);
if(!dir) {
logError(LOG_FT,"Failed to find icon directory for server {}", server ? server->getServerId() : 0);
@ -261,11 +261,11 @@ void FileServer::setupServer(const shared_ptr<TSServer> &server) {
}
}
std::string FileServer::server_file_base(const std::shared_ptr<ts::server::TSServer> &server) {
std::string FileServer::server_file_base(const std::shared_ptr<ts::server::VirtualServer> &server) {
return rootPath + "/server_" + to_string(server->getServerId());
}
void FileServer::deleteServer(const shared_ptr<TSServer> &server) {
void FileServer::deleteServer(const shared_ptr<VirtualServer> &server) {
fs::path path = fs::u8path(rootPath + "/server_" + to_string(server ? server->getServerId() : 0));
if(fs::exists(path)) {
error_code error;
@ -591,7 +591,7 @@ void FileServer::tickFileClient(std::shared_ptr<FileClient> cl) {
}
struct TransfareGroup {
shared_ptr<TSServer> server;
shared_ptr<VirtualServer> server;
deque<shared_ptr<FileClient>> clients;
enum {
upload,

View File

@ -72,7 +72,7 @@ namespace ts {
namespace server {
class TSServer;
class VirtualServer;
class FileClient;
//FIXME Valid path
@ -106,14 +106,14 @@ namespace ts {
std::shared_ptr<file::FileTransfereKey> generateDownloadTransferKey(std::string &errorMessage, std::string targetFile, size_t offset, const std::shared_ptr<ConnectedClient>&);
std::shared_ptr<file::FileTransfereKey> generateUploadTransferKey(std::string &errorMessage, std::string targetFile, size_t size, size_t offset, const std::shared_ptr<ConnectedClient>&);
std::shared_ptr<file::Directory> resolveDirectory(const std::shared_ptr<TSServer> &, std::shared_ptr<BasicChannel>, std::string = "");
std::shared_ptr<file::Directory> iconDirectory(const std::shared_ptr<TSServer> &);
bool iconExists(const std::shared_ptr<TSServer> &, IconId);
std::shared_ptr<file::Directory> avatarDirectory(const std::shared_ptr<TSServer> &);
std::shared_ptr<file::Directory> resolveDirectory(const std::shared_ptr<VirtualServer> &, std::shared_ptr<BasicChannel>, std::string = "");
std::shared_ptr<file::Directory> iconDirectory(const std::shared_ptr<VirtualServer> &);
bool iconExists(const std::shared_ptr<VirtualServer> &, IconId);
std::shared_ptr<file::Directory> avatarDirectory(const std::shared_ptr<VirtualServer> &);
std::string server_file_base(const std::shared_ptr<TSServer> &);
void setupServer(const std::shared_ptr<TSServer> &);
void deleteServer(const std::shared_ptr<TSServer> &);
std::string server_file_base(const std::shared_ptr<VirtualServer> &);
void setupServer(const std::shared_ptr<VirtualServer> &);
void deleteServer(const std::shared_ptr<VirtualServer> &);
void tickFileClient(std::shared_ptr<FileClient>);
void instanceTick();

View File

@ -1,6 +1,6 @@
#include <csignal>
#include <src/SignalHandler.h>
#include <src/TSServer.h>
#include <src/VirtualServer.h>
#include <src/client/ConnectedClient.h>
#include <src/ServerManager.h>
#include <src/InstanceHandler.h>

View File

@ -1,4 +1,4 @@
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "TeamSpeakWebClient.h"
#include "log/LogUtils.h"
#include "src/server/VoiceServer.h"
@ -7,7 +7,7 @@ using namespace ts;
using namespace ts::weblist;
using namespace ts::server;
TSWebClient::TSWebClient(const std::shared_ptr<TSServer> &server, struct event_base *event_base, uint16_t session_index, bool resend_name) : server(server), event_base(event_base), session_index(session_index), send_name(resend_name) { }
TSWebClient::TSWebClient(const std::shared_ptr<VirtualServer> &server, struct event_base *event_base, uint16_t session_index, bool resend_name) : server(server), event_base(event_base), session_index(session_index), send_name(resend_name) { }
TSWebClient::~TSWebClient() {
this->unregister_events(true);

View File

@ -7,7 +7,7 @@
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
}
namespace weblist {
@ -21,7 +21,7 @@ namespace ts {
S_FINALIZED
};
TSWebClient(const std::shared_ptr <server::TSServer> &server, struct event_base *event_base, uint16_t session_index, bool /* resend name */);
TSWebClient(const std::shared_ptr <server::VirtualServer> &server, struct event_base *event_base, uint16_t session_index, bool /* resend name */);
virtual ~TSWebClient();
void report();
@ -32,7 +32,7 @@ namespace ts {
std::function<void(const std::string&, bool)> callback_error;
std::function<void()> callback_success;
private:
std::shared_ptr<server::TSServer> server;
std::shared_ptr<server::VirtualServer> server;
struct event_base* event_base = nullptr;
std::thread close_thread;
State state;

View File

@ -1,6 +1,6 @@
#include <algorithm>
#include <thread>
#include "src/TSServer.h"
#include "src/VirtualServer.h"
#include "log/LogUtils.h"
#include "TeamSpeakWebClient.h"
#include "WebListManager.h"
@ -33,7 +33,7 @@ WebListManager::~WebListManager() {
event_base_free(base);
}
void WebListManager::enable_report(const std::shared_ptr<ts::server::TSServer> &server) {
void WebListManager::enable_report(const std::shared_ptr<ts::server::VirtualServer> &server) {
{
unique_lock lock(this->entry_lock);
for(const auto& entry : this->entries) {
@ -49,7 +49,7 @@ void WebListManager::enable_report(const std::shared_ptr<ts::server::TSServer> &
}
}
bool WebListManager::reports_enabled(const std::shared_ptr<ts::server::TSServer> &server) {
bool WebListManager::reports_enabled(const std::shared_ptr<ts::server::VirtualServer> &server) {
{
lock_guard lock(this->entry_lock);
for(const auto& entry : this->entries) {
@ -59,7 +59,7 @@ bool WebListManager::reports_enabled(const std::shared_ptr<ts::server::TSServer>
return false;
}
void WebListManager::disable_report(const std::shared_ptr<ts::server::TSServer> &server) {
void WebListManager::disable_report(const std::shared_ptr<ts::server::VirtualServer> &server) {
if(!server) return;
unique_lock lock(this->entry_lock);

View File

@ -9,14 +9,14 @@
struct event_base;
namespace ts {
namespace server {
class TSServer;
class VirtualServer;
}
namespace weblist {
class TSWebClient;
class WebListManager {
private:
struct Entry {
std::shared_ptr<server::TSServer> server;
std::shared_ptr<server::VirtualServer> server;
std::shared_ptr<TSWebClient> current_request;
std::chrono::system_clock::time_point last_success;
@ -30,9 +30,9 @@ namespace ts {
WebListManager();
~WebListManager();
void enable_report(const std::shared_ptr<server::TSServer>& /* server */);
bool reports_enabled(const std::shared_ptr<server::TSServer>& /* server */);
void disable_report(const std::shared_ptr<server::TSServer>& /* server */);
void enable_report(const std::shared_ptr<server::VirtualServer>& /* server */);
bool reports_enabled(const std::shared_ptr<server::VirtualServer>& /* server */);
void disable_report(const std::shared_ptr<server::VirtualServer>& /* server */);
void tick();