[英]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 .我正在使用 Cloud Files API 和这个项目实现一个虚拟驱动器。 However, the download is stuck on files larger than 4Gb.
但是,下载会停留在大于 4Gb 的文件上。 The progress stops and the TransferDataAsync() is never called again, even though there are more bytes left in the file.
进度停止,并且永远不会再次调用 TransferDataAsync(),即使文件中还有更多字节。
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.
因此,仅对超过 4Gb 的文件执行此操作才有意义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.