cloud data send optimize

This commit is contained in:
2021-09-01 17:48:58 +03:00
parent 35a3ce6402
commit 00edfa4ef0
5 changed files with 23 additions and 21 deletions

View File

@@ -33,7 +33,7 @@ PICloud::TCP::Header::Header() {
PICloud::TCP::TCP(PIStreamPacker * s) : streampacker(s) {
streampacker->setMaxPacketSize(63*1024);
}
void PICloud::TCP::setRole(PICloud::TCP::Role r) {
@@ -141,11 +141,8 @@ PIPair<PICloud::TCP::Type, PICloud::TCP::Role> PICloud::TCP::parseHeader(PIByteA
}
PIByteArray PICloud::TCP::parseData(PIByteArray & ba) {
if (header.role == Client) {
return ba;
}
return PIByteArray();
bool PICloud::TCP::canParseData(PIByteArray & ba) {
return header.role == Client;
}
@@ -154,7 +151,7 @@ PIPair<uint, PIByteArray> PICloud::TCP::parseDataServer(PIByteArray & ba) {
ret.first = 0;
if (header.role == Server) {
ba >> ret.first;
ret.second = ba;
ret.second.swap(ba);
}
return ret;
}