PIClout data send and receive test

This commit is contained in:
2021-04-07 18:03:28 +03:00
parent 21e00e7176
commit bf63b0e9f3
6 changed files with 115 additions and 36 deletions

View File

@@ -113,8 +113,8 @@ bool PICloudServer::Client::openDevice() {
bool PICloudServer::Client::closeDevice() {
server->clientDisconnect(client_id);
if (is_connected) {
server->clientDisconnect(client_id);
is_connected = false;
cond_buff.notifyOne();
}
@@ -170,7 +170,10 @@ void PICloudServer::_readed(PIByteArray & ba) {
case PICloud::TCP::Disconnect: {
uint id = tcp.parseDisconnect(ba);
Client * oc = index_clients.value(id, nullptr);
if (oc) oc->close();
if (oc) {
oc->is_connected = false;
oc->close();
}
} break;
case PICloud::TCP::Data: {
PIPair<uint, PIByteArray> d = tcp.parseDataServer(ba);