From: 강현호/Tizen Platform Lab(SR)/Engineer/삼성전자 Date: Wed, 28 Apr 2021 07:59:48 +0000 (+0900) Subject: Merge branch 'master' into master X-Git-Tag: submit/tizen/20210806.015209~67 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f19730c8f4ce091538ca07e0814ae4a54dd5a63d;p=platform%2Fcore%2Fappfw%2Fcion.git Merge branch 'master' into master --- f19730c8f4ce091538ca07e0814ae4a54dd5a63d diff --cc cion/channel/async_sender.hh index d93451d,2cc26a2..ef9e408 --- a/cion/channel/async_sender.hh +++ b/cion/channel/async_sender.hh @@@ -74,44 -74,69 +78,38 @@@ class AsyncSender std::thread thd([](cmd::CionCmd cmd, std::shared_ptr>> dplist, std::vector raw, - std::string path) { - std::string path, - IPayload::PayloadType type){ - - if (type == IPayload::PayloadType::File) { - - std::ifstream p_file; - LOG(INFO) << "@@@ send file : " << path; - p_file.open(path, std::ifstream::in | std::ifstream::binary); - - /* file read */ - int remaining_size; - int send_size; - char* buf = nullptr; - - p_file.seekg(0, p_file.end); - remaining_size = p_file.tellg(); - p_file.seekg(0, p_file.beg); - int cnt = 0; - - LOG(INFO) << "@@@ send file remain : " << remaining_size; - - while (remaining_size > 0) { - cnt++; - LOG(INFO) << "@@@ send file cnt : " << cnt; - LOG(INFO) << "@@@ send file remain : " << remaining_size; - - if (remaining_size > kVineDpMaxBufferSize) { - send_size = kVineDpMaxBufferSize; - remaining_size = remaining_size - kVineDpMaxBufferSize; - } else { - send_size = remaining_size; - remaining_size = 0; - } - - LOG(INFO) << "@@@ send file open size " << send_size; - if (buf == nullptr) - buf = new char[send_size]; - - p_file.read(buf, send_size); - - tizen_base::Parcel parcel; - - /* send - same with data but maybe changed for big file */ - parcel.WriteUInt32(cmd); - parcel.WriteUInt32(raw.size()); - parcel.Write(raw.data(), raw.size()); - parcel.WriteUInt32(send_size); - parcel.Write(buf, send_size); - parcel.WriteUInt32(cnt); - - for (std::shared_ptr i : *dplist) - i->SendDataAsync(parcel.GetRaw()); - - LOG(INFO) << "@@@ file " << parcel.GetRaw().size() <<" : " << send_size; - } - - if (buf != nullptr) - delete[] buf; - - p_file.close(); - - } else { ++ std::string path){ + std::ifstream p_file; + LOG(INFO) << "send file : " << path; + p_file.open(path, std::ifstream::in | std::ifstream::binary); + + /* file read */ + int remaining_size; + int send_size; + char* buf = nullptr; + + p_file.seekg(0, p_file.end); + remaining_size = p_file.tellg(); + p_file.seekg(0, p_file.beg); + int cnt = 0; + + LOG(INFO) << "send file remain : " << remaining_size; ++ + while (remaining_size > 0) { + cnt++; + LOG(INFO) << "send file cnt : " << cnt; + LOG(INFO) << "send file remain : " << remaining_size; + - if (remaining_size > MAX_BUFFER_SIZE) { - send_size = MAX_BUFFER_SIZE; - remaining_size = remaining_size - MAX_BUFFER_SIZE; ++ if (remaining_size > kVineDpMaxBufferSize) { ++ send_size = kVineDpMaxBufferSize; ++ remaining_size = remaining_size - kVineDpMaxBufferSize; + } else { + send_size = remaining_size; + remaining_size = 0; + } - - LOG(INFO) << "send file open size " << send_size; - if (buf == nullptr) - buf = new char[send_size]; - - p_file.read(buf, send_size); - tizen_base::Parcel parcel; + + /* send - same with data but maybe changed for big file */ parcel.WriteUInt32(cmd); parcel.WriteUInt32(raw.size()); parcel.Write(raw.data(), raw.size());