picloud ping and fix big bugs
This commit is contained in:
@@ -53,6 +53,10 @@ void DispatcherServer::cleanClients() {
|
||||
if (!rm_clients.contains(c)) rm_clients << c;
|
||||
} else rm_clients.removeAll(c);
|
||||
}
|
||||
auto ss = c_servers.values();
|
||||
for (auto c: ss) {
|
||||
if (c->lastPing() > 15.0) rmrf_clients << const_cast<DispatcherClient *>(c->getConnection());
|
||||
}
|
||||
for (auto c: rm_clients) {
|
||||
if (clients.contains(c)) {
|
||||
rmrf_clients << c;
|
||||
@@ -60,7 +64,10 @@ void DispatcherServer::cleanClients() {
|
||||
}
|
||||
for (auto c: rmrf_clients) {
|
||||
clients.removeAll(c);
|
||||
index_c_servers.remove(c);
|
||||
if(index_c_servers.contains(c)) {
|
||||
c_servers.remove(c_servers.key(index_c_servers[c]));
|
||||
index_c_servers.remove(c);
|
||||
}
|
||||
index_c_clients.remove(c);
|
||||
rm_clients.removeAll(c);
|
||||
}
|
||||
@@ -226,9 +233,9 @@ void DispatcherServer::newConnection(PIEthernet *cl) {
|
||||
CloudServer * cs = c_servers.value(sname, nullptr);
|
||||
if (cs) {
|
||||
piCoutObj << "add new Client to Server ->" << sname.toHex();
|
||||
c->authorise(true);
|
||||
cs->addClient(c);
|
||||
index_c_clients.insert(c, cs);
|
||||
c->authorise(true);
|
||||
} else {
|
||||
rm_clients << c;
|
||||
piCoutObj << "Client can't connect to Server ->" << sname.toHex();
|
||||
|
||||
Reference in New Issue
Block a user