fail reconnect

This commit is contained in:
2021-08-20 18:25:59 +03:00
parent 99e135caa2
commit 5cc8ef1eb0
5 changed files with 35 additions and 36 deletions

View File

@@ -29,6 +29,7 @@ PICloudServer::PICloudServer(const PIString & path, PIIODevice::DeviceMode mode)
CONNECTL(&eth, connected, [this](){tcp.sendStart();});
CONNECTL(&eth, disconnected, [this](bool){
piCoutObj << "disconnected";
static_cast<PIThread*>(&eth)->stop();
opened_ = false;
piMSleep(100);
});
@@ -142,8 +143,8 @@ bool PICloudServer::Client::closeDevice() {
int PICloudServer::Client::readDevice(void * read_to, int max_size) {
if (!is_connected) return -1;
int sz = -1;
if (!is_connected) return 0;
int sz = 0;
mutex_buff.lock();
cond_buff.wait(mutex_buff, [this](){return !buff.isEmpty() || !is_connected;});
if (is_connected) {