version 2.30

PIStreamPacker remove progresses
picloud various fixes
This commit is contained in:
2021-09-01 23:48:13 +03:00
parent f82b6c12ee
commit 991a074538
5 changed files with 20 additions and 92 deletions

View File

@@ -31,11 +31,13 @@ PICloudClient::PICloudClient(const PIString & path, PIIODevice::DeviceMode mode)
CONNECTU(&streampacker, packetReceiveEvent, this, _readed);
CONNECTL(&eth, disconnected, [this](bool){
if (is_deleted) return;
bool need_disconn = is_connected;
//piCoutObj << "eth disconnected";
static_cast<PIThread*>(&eth)->stop();
opened_ = false;
if (is_connected) disconnected();
internalDisconnect();
if (need_disconn)
disconnected();
//piCoutObj << "eth disconnected done";
});
}
@@ -45,8 +47,7 @@ PICloudClient::~PICloudClient() {
//piCoutObj << "~PICloudClient()";
PIThread::stop();
//eth.close();
if (is_connected) disconnected();
is_connected = false;
//if (is_connected) disconnected();
close();
//piCoutObj << "~PICloudClient() closed";
internalDisconnect();
@@ -133,22 +134,24 @@ void PICloudClient::internalDisconnect() {
is_connected = false;
cond_buff.notifyOne();
cond_connect.notifyOne();
streampacker.clear();
buff.clear();
}
void PICloudClient::_readed(PIByteArray & ba) {
if (is_deleted) return;
//piCoutObj << "_readed";
PIPair<PICloud::TCP::Type, PICloud::TCP::Role> hdr = tcp.parseHeader(ba);
//piCoutObj << "_readed" << ba.size() << hdr.first << hdr.second;
if (hdr.second == tcp.role()) {
switch (hdr.first) {
case PICloud::TCP::Connect:
if (tcp.parseConnect(ba) == 1) {
mutex_connect.lock();
is_connected = true;
connected();
mutex_connect.unlock();
cond_connect.notifyOne();
connected();
}
break;
case PICloud::TCP::Disconnect: