简体   繁体   中英

How to overcome 4Gb limitation on file download in virtual drive based on Cloud Sync Engine?

I am implementing a virtual drive using Cloud Files API and this project . However, the download is stuck on files larger than 4Gb. The progress stops and the TransferDataAsync() is never called again, even though there are more bytes left in the file.

You need to add optional length to the segment length:

public async Task TransferDataAsync(long offset, long length,
    ITransferDataOperationContext operationContext, ITransferDataResultContext resultContext)
{
    if (operationContext.FileSize > 0x100000000)
    {
        length += operationContext.OptionalLength;
    }
    …
}

From my experience, this will somewhat slow down the download for small files. So it makes sense to do this only for files over 4Gb.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM