Some changes

This commit is contained in:
WolverinDEV
2019-08-25 22:16:42 +02:00
parent 787f911b6f
commit 79f8c91157
17 changed files with 320 additions and 119 deletions
+13 -7
View File
@@ -37,7 +37,7 @@ ConnectedClient::~ConnectedClient() {
memtrack::freed<ConnectedClient>(this);
}
std::shared_ptr<ConnectionInfoData> ConnectedClient::requestConnectionInfo(const std::shared_ptr<ConnectedClient>& receiver) {
std::shared_ptr<ConnectionInfoData> ConnectedClient::request_connection_info(const std::shared_ptr<ConnectedClient> &receiver, bool& send_temp) {
auto& info = this->connection_info;
lock_guard info_lock(info.lock);
@@ -49,11 +49,17 @@ std::shared_ptr<ConnectionInfoData> ConnectedClient::requestConnectionInfo(const
info.data = nullptr;
}
info.receiver.erase(std::remove_if(info.receiver.begin(), info.receiver.end(), [&](const weak_ptr<ConnectedClient>& weak) {
auto locked = weak.lock();
return !locked || locked == receiver;
}), info.receiver.end());
info.receiver.push_back(receiver);
if(receiver) {
info.receiver.erase(std::remove_if(info.receiver.begin(), info.receiver.end(), [&](const weak_ptr<ConnectedClient>& weak) {
auto locked = weak.lock();
if(locked == receiver) {
send_temp = true;
return true;
}
return !locked;
}), info.receiver.end());
info.receiver.push_back(receiver);
}
if(chrono::system_clock::now() - info.last_requested >= chrono::seconds(1)) {
info.last_requested = chrono::system_clock::now();
@@ -764,7 +770,7 @@ void ConnectedClient::sendServerInit() {
command["lt"] = LicenseType::LICENSE_HOSTING;
} else
command["lt"] = ts::config::server::DefaultServerLicense;
command["pv"] = 6; //Protocol version
command["pv"] = 6; //Protocol version
command["acn"] = this->getDisplayName();
command["aclid"] = this->getClientId();
if(dynamic_cast<VoiceClient*>(this)) {