Skip to content

Commit

Permalink
Merge pull request #1433 from meganz/hotfix/transfer_cloudraid_progre…
Browse files Browse the repository at this point in the history
…ss_include_piror_progress

Fix progress calculation for cloudraid files
  • Loading branch information
sergiohs84 authored Apr 29, 2019
2 parents aa397c8 + e1be26d commit 34367ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/raid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ m_off_t RaidBufferManager::progress() const
}
}

return raidpartspos * (RAIDPARTS - 1) + reportPos - startfilepos;
return reportPos;
}


Expand Down
24 changes: 7 additions & 17 deletions src/transferslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void TransferSlot::doio(MegaClient* client)
break;

case REQ_SUCCESS:
if (client->orderdownloadedchunks && transfer->type == GET && transfer->progresscompleted != static_cast<HttpReqDL*>(reqs[i])->dlpos)
if (client->orderdownloadedchunks && transfer->type == GET && !transferbuf.isRaid() && transfer->progresscompleted != static_cast<HttpReqDL*>(reqs[i])->dlpos)
{
// postponing unsorted chunk
p += reqs[i]->size;
Expand Down Expand Up @@ -650,7 +650,7 @@ void TransferSlot::doio(MegaClient* client)
asyncIO[i] = NULL;
}

p += reqs[i]->size;
p += outputPiece->buf.datalen();

LOG_debug << "Writing data asynchronously at " << outputPiece->pos << " to " << (outputPiece->pos + outputPiece->buf.datalen());
asyncIO[i] = fa->asyncfwrite(outputPiece->buf.datastart(), outputPiece->buf.datalen(), outputPiece->pos);
Expand Down Expand Up @@ -830,7 +830,7 @@ void TransferSlot::doio(MegaClient* client)
client->transfercacheadd(transfer);
reqs[i]->status = REQ_READY;

if (client->orderdownloadedchunks)
if (client->orderdownloadedchunks && !transferbuf.isRaid())
{
// Check connections again looking for postponed chunks
delete asyncIO[i];
Expand Down Expand Up @@ -1099,21 +1099,11 @@ void TransferSlot::doio(MegaClient* client)

if (transfer->type == GET && transferbuf.isRaid())
{
// for Raid, sum up all the data received so far
p = transferbuf.progress();
for (int i = connections; i--; )
{
if (reqs[i] && reqs[i]->status == REQ_INFLIGHT)
{
p += static_cast<HttpReqDL*>(reqs[i])->bufpos;
}
}
// for Raid, additionally we need the raid data that's waiting to be recombined
p += transferbuf.progress();
}
else
{
p += transfer->progresscompleted;
}

p += transfer->progresscompleted;

if (p != progressreported || (Waiter::ds - lastprogressreport) > PROGRESSTIMEOUT)
{
if (p != progressreported)
Expand Down

0 comments on commit 34367ec

Please sign in to comment.