cloud data send optimize

This commit is contained in:
2021-09-01 17:48:58 +03:00
parent 35a3ce6402
commit 00edfa4ef0
5 changed files with 23 additions and 21 deletions

View File

@@ -27,14 +27,13 @@ PIByteArray CloudServer::serverUUID() const {
void CloudServer::addClient(DispatcherClient * c) {
last_ping.reset();
clients << c;
index_clients.insert(c->clientId(), c);
uint cid = c->clientId();
index_clients.insert(cid, c);
c->sendConnected(1);
server->sendConnected(c->clientId());
CONNECTL(c, dataReaded, ([this, c](PIByteArray & ba){
server->sendConnected(cid);
CONNECTL(c, dataReaded, ([this, cid](PIByteArray & ba){
// piCoutObj << c->clientId() << "dataReaded";
if (clients.contains(c)) {
server->sendDataToClient(ba, c->clientId());
}
server->sendDataToClient(ba, cid);
}));
}