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