mirror of https://github.com/aria2/aria2
MultiDiskAdaptor: Handle short read
parent
8750d7be99
commit
a3426821c8
|
@ -389,12 +389,22 @@ ssize_t MultiDiskAdaptor::readData
|
||||||
if(!(*i)->isOpen()) {
|
if(!(*i)->isOpen()) {
|
||||||
throwOnDiskWriterNotOpened((*i).get(), offset+(len-rem));
|
throwOnDiskWriterNotOpened((*i).get(), offset+(len-rem));
|
||||||
}
|
}
|
||||||
totalReadLength +=
|
|
||||||
(*i)->getDiskWriter()->readData(data+(len-rem), readLength, fileOffset);
|
while(readLength > 0) {
|
||||||
rem -= readLength;
|
auto nread = (*i)->getDiskWriter()->readData(data+(len-rem),
|
||||||
if(dropCache) {
|
readLength, fileOffset);
|
||||||
(*i)->getDiskWriter()->dropCache(readLength, fileOffset);
|
|
||||||
|
totalReadLength += nread;
|
||||||
|
|
||||||
|
if(dropCache) {
|
||||||
|
(*i)->getDiskWriter()->dropCache(nread, fileOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
readLength -= nread;
|
||||||
|
rem -= nread;
|
||||||
|
fileOffset += nread;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileOffset = 0;
|
fileOffset = 0;
|
||||||
if(rem == 0) {
|
if(rem == 0) {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue