PIIODevice threaded read refactoring

This commit is contained in:
2022-10-23 16:02:09 +03:00
parent e5777dde6c
commit 9438ab4e53
9 changed files with 157 additions and 121 deletions

View File

@@ -29,7 +29,7 @@ PICloudServer::PICloudServer(const PIString & path, PIIODevice::DeviceMode mode)
CONNECTL(&eth, connected, [this](){opened_ = true; piCoutObj << "connected"; tcp.sendStart();});
CONNECTL(&eth, disconnected, [this](bool){
piCoutObj << "disconnected";
static_cast<PIThread*>(&eth)->stop();
eth.stopThreadedRead();
opened_ = false;
ping_timer.stop(false);
piMSleep(100);
@@ -135,7 +135,7 @@ bool PICloudServer::Client::openDevice() {
bool PICloudServer::Client::closeDevice() {
PIThread::stop(false);
softStopThreadedRead();
if (is_connected) {
server->clientDisconnect(client_id);
is_connected = false;