This commit is contained in:
2021-08-20 18:30:19 +03:00
parent 5cc8ef1eb0
commit 1cc46468c1
2 changed files with 6 additions and 6 deletions

View File

@@ -25,12 +25,12 @@ PICloudClient::PICloudClient(const PIString & path, PIIODevice::DeviceMode mode)
tcp.setRole(PICloud::TCP::Client);
setName("cloud_client");
is_connected = false;
CONNECTL(&eth, connected, [this](){opened_ = true; tcp.sendStart();});
CONNECTL(&eth, connected, [this](){/*opened_ = true;*/ tcp.sendStart();});
CONNECTU(&streampacker, packetReceiveEvent, this, _readed);
CONNECTL(&eth, disconnected, [this](bool){
piCoutObj << "disconnected";
static_cast<PIThread*>(&eth)->stop();
opened_ = false;
//opened_ = false;
if (is_connected) disconnected();
internalDisconnect();
piMSleep(100);
@@ -95,8 +95,8 @@ bool PICloudClient::closeDevice() {
int PICloudClient::readDevice(void * read_to, int max_size) {
// piCoutObj << "readDevice";
if (!is_connected) return 0;
int sz = 0;
if (!is_connected) return -1;
int sz = -1;
mutex_buff.lock();
cond_buff.wait(mutex_buff, [this](){return !buff.isEmpty() || !is_connected;});
if (is_connected) {