Merge branch 'master' into master
author강현호/Tizen Platform Lab(SR)/Engineer/삼성전자 <hhstark.kang@samsung.com>
Wed, 28 Apr 2021 07:59:48 +0000 (16:59 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 28 Apr 2021 07:59:48 +0000 (16:59 +0900)
1  2 
cion/channel/async_sender.hh
cion/tizen-api/cion_server.cc

index d93451de002a8771ef72f54259672323e61e0c0a,2cc26a2754c47f906f3db6effafddc8fbc235928..ef9e4080d0347733fadfa9ba6381561540e644d3
@@@ -74,44 -74,69 +78,38 @@@ class AsyncSender 
      std::thread thd([](cmd::CionCmd cmd,
          std::shared_ptr<std::list<std::shared_ptr<VineDp>>> dplist,
          std::vector<uint8_t> 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<VineDp> 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());
Simple merge