Commit 2d653ee5 authored by Sébastien Blin's avatar Sébastien Blin

data_transfer: directly pass the buffer

Change-Id: I62f93b4b0706863debc9595b0b4646c3b0974b52
parent 0e6cc9c1
......@@ -832,15 +832,15 @@ IncomingFile::cancel()
void
IncomingFile::process()
{
channel_->setOnRecv([w=weak()](const uint8_t* buf, size_t len) {
channel_->setOnRecv([w = weak()](const uint8_t* buf, size_t len) {
if (auto shared = w.lock()) {
if (shared->stream_.is_open())
shared->stream_ << std::string_view((const char*) buf, len);
shared->stream_.write(reinterpret_cast<const char*>(buf), len);
shared->info_.bytesProgress = shared->stream_.tellp();
}
return len;
});
channel_->onShutdown([w=weak()] {
channel_->onShutdown([w = weak()] {
auto shared = w.lock();
if (!shared)
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment