PICloud many important fixes

This commit is contained in:
Бычков Андрей
2022-11-11 16:18:05 +03:00
parent ec8fbcb112
commit cb59017ebb
9 changed files with 57 additions and 19 deletions

View File

@@ -58,7 +58,18 @@ void DispatcherServer::cleanClients() {
for (auto c: ss) {
if (c->lastPing() > 15.0) {
piCout << "remove Server by ping timeout" << c->getConnection()->clientId();
PIVector<DispatcherClient *> cscv = c->getClients();
for(auto csc : cscv) {
clients.removeAll(csc);
index_c_clients.remove(csc);
c->removeClient(csc);
csc->close();
rmrf_clients << csc;
}
c_servers.remove(c->serverUUID());
index_c_servers.remove(c->getConnection());
rmrf_clients << const_cast<DispatcherClient *>(c->getConnection());
delete c;
}
}
for (auto c: rm_clients) {
@@ -250,8 +261,8 @@ void DispatcherServer::newConnection(PIEthernet *cl) {
map_mutex.unlock();
});
//piCoutObj << "add client" << client;
client->start();
map_mutex.lock();
clients.push_back(client);
map_mutex.unlock();
client->start();
}