cloud_dispatcher patch

This commit is contained in:
2021-09-01 22:43:40 +03:00
parent 00edfa4ef0
commit f82b6c12ee
3 changed files with 9 additions and 3 deletions

View File

@@ -56,7 +56,10 @@ void DispatcherServer::cleanClients() {
}
auto ss = c_servers.values();
for (auto c: ss) {
if (c->lastPing() > 15.0) rmrf_clients << const_cast<DispatcherClient *>(c->getConnection());
if (c->lastPing() > 15.0) {
piCout << "remove Server by ping timeout" << c->getConnection()->clientId();
rmrf_clients << const_cast<DispatcherClient *>(c->getConnection());
}
}
for (auto c: rm_clients) {
if (clients.contains(c)) {
@@ -178,12 +181,13 @@ void DispatcherServer::disconnectClient(DispatcherClient *client) {
//piCoutObj << "INVALID client" << client;
return;
}
piCoutObj << "remove client" << client->clientId();
piCoutObj << "remove" << client->clientId();
map_mutex.lock();
clients.removeAll(client);
rm_clients.removeAll(client);
CloudServer * cs = index_c_servers.value(client, nullptr);
if (cs) {
piCoutObj << "remove Server" << client->clientId();
PIVector<DispatcherClient *> cscv = cs->getClients();
for(auto csc : cscv) {
clients.removeAll(csc);
@@ -198,6 +202,7 @@ void DispatcherServer::disconnectClient(DispatcherClient *client) {
}
CloudServer * cc = index_c_clients.value(client, nullptr);
if (cc) {
piCoutObj << "remove Client" << client->clientId();
cc->removeClient(client);
index_c_clients.remove(client);
}