cloud fix ... ((
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
CloudServer::CloudServer(DispatcherClient * c, const PIByteArray & sname): server(c) {
|
||||
setName(sname.toHex());
|
||||
server_uuid = sname;
|
||||
CONNECTL(c, dataReadedServer, ([this](uint id, PIByteArray & ba) {
|
||||
last_ping.reset();
|
||||
mutex_clients.lock();
|
||||
DispatcherClient * cl = index_clients.value(id, nullptr);
|
||||
mutex_clients.unlock();
|
||||
if (cl) cl->sendData(ba);
|
||||
}));
|
||||
CONNECTL(c, pingReceived, [this]() { last_ping.reset(); });
|
||||
connects << CONNECTL(c, dataReadedServer, ([this](uint id, PIByteArray & ba) {
|
||||
last_ping.reset();
|
||||
mutex_clients.lock();
|
||||
DispatcherClient * cl = index_clients.value(id, nullptr);
|
||||
mutex_clients.unlock();
|
||||
if (cl) cl->sendData(ba);
|
||||
}));
|
||||
connects << CONNECTL(c, pingReceived, [this]() { last_ping.reset(); });
|
||||
last_ping.reset();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ CloudServer::~CloudServer() {
|
||||
for (auto c: clients) {
|
||||
c->close();
|
||||
}
|
||||
for (auto & c: connects)
|
||||
c.disconnect();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +72,11 @@ void CloudServer::close() {
|
||||
}
|
||||
|
||||
|
||||
void CloudServer::stop() {
|
||||
server->stop();
|
||||
}
|
||||
|
||||
|
||||
void CloudServer::printStatus() {
|
||||
PIMutexLocker locker(mutex_clients);
|
||||
piCout << " "
|
||||
|
||||
Reference in New Issue
Block a user