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()) {
|
||||
throwOnDiskWriterNotOpened((*i).get(), offset+(len-rem));
|
||||
}
|
||||
totalReadLength +=
|
||||
(*i)->getDiskWriter()->readData(data+(len-rem), readLength, fileOffset);
|
||||
rem -= readLength;
|
||||
|
||||
while(readLength > 0) {
|
||||
auto nread = (*i)->getDiskWriter()->readData(data+(len-rem),
|
||||
readLength, fileOffset);
|
||||
|
||||
totalReadLength += nread;
|
||||
|
||||
if(dropCache) {
|
||||
(*i)->getDiskWriter()->dropCache(readLength, fileOffset);
|
||||
(*i)->getDiskWriter()->dropCache(nread, fileOffset);
|
||||
}
|
||||
|
||||
readLength -= nread;
|
||||
rem -= nread;
|
||||
fileOffset += nread;
|
||||
}
|
||||
|
||||
fileOffset = 0;
|
||||
if(rem == 0) {
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue