DefaultPieceStorage.cc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2006 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "DefaultPieceStorage.h"
  36. #include "DownloadContext.h"
  37. #include "Piece.h"
  38. #include "Peer.h"
  39. #include "LogFactory.h"
  40. #include "Logger.h"
  41. #include "prefs.h"
  42. #include "DirectDiskAdaptor.h"
  43. #include "MultiDiskAdaptor.h"
  44. #include "CopyDiskAdaptor.h"
  45. #include "DiskWriter.h"
  46. #include "BitfieldManFactory.h"
  47. #include "BitfieldMan.h"
  48. #include "message.h"
  49. #include "DefaultDiskWriterFactory.h"
  50. #include "FileEntry.h"
  51. #include "DlAbortEx.h"
  52. #include "Util.h"
  53. #include "a2functional.h"
  54. #include "Option.h"
  55. #include "StringFormat.h"
  56. #include "RarestPieceSelector.h"
  57. #include <numeric>
  58. #include <algorithm>
  59. namespace aria2 {
  60. DefaultPieceStorage::DefaultPieceStorage(const DownloadContextHandle& downloadContext, const Option* option, bool randomPieceStatsOrdering):
  61. downloadContext(downloadContext),
  62. bitfieldMan(BitfieldManFactory::getFactoryInstance()->
  63. createBitfieldMan(downloadContext->getPieceLength(),
  64. downloadContext->getTotalLength())),
  65. _diskWriterFactory(new DefaultDiskWriterFactory()),
  66. endGamePieceNum(END_GAME_PIECE_NUM),
  67. logger(LogFactory::getInstance()),
  68. option(option),
  69. _pieceSelector(new RarestPieceSelector(downloadContext->getNumPieces(),
  70. randomPieceStatsOrdering))
  71. {}
  72. DefaultPieceStorage::~DefaultPieceStorage() {
  73. delete bitfieldMan;
  74. }
  75. bool DefaultPieceStorage::hasMissingPiece(const PeerHandle& peer)
  76. {
  77. return bitfieldMan->hasMissingPiece(peer->getBitfield(),
  78. peer->getBitfieldLength());
  79. }
  80. bool DefaultPieceStorage::isEndGame()
  81. {
  82. return bitfieldMan->countMissingBlock() <= endGamePieceNum;
  83. }
  84. bool DefaultPieceStorage::getMissingPieceIndex(size_t& index, const PeerHandle& peer)
  85. {
  86. std::deque<size_t> indexes;
  87. bool r;
  88. if(isEndGame()) {
  89. r = bitfieldMan->getAllMissingIndexes(indexes, peer->getBitfield(),
  90. peer->getBitfieldLength());
  91. } else {
  92. r = bitfieldMan->getAllMissingUnusedIndexes(indexes,
  93. peer->getBitfield(),
  94. peer->getBitfieldLength());
  95. }
  96. if(r) {
  97. // We assume indexes is sorted using comparator less.
  98. _pieceSelector->select(index, indexes);
  99. return true;
  100. } else {
  101. return false;
  102. }
  103. }
  104. PieceHandle DefaultPieceStorage::checkOutPiece(size_t index)
  105. {
  106. bitfieldMan->setUseBit(index);
  107. PieceHandle piece = findUsedPiece(index);
  108. if(piece.isNull()) {
  109. piece.reset(new Piece(index, bitfieldMan->getBlockLength(index)));
  110. addUsedPiece(piece);
  111. return piece;
  112. } else {
  113. return piece;
  114. }
  115. }
  116. /**
  117. * Newly instantiated piece is not added to usedPieces.
  118. * Because it is waste of memory and there is no chance to use them later.
  119. */
  120. PieceHandle DefaultPieceStorage::getPiece(size_t index)
  121. {
  122. PieceHandle piece;
  123. if(0 <= index && index <= bitfieldMan->getMaxIndex()) {
  124. piece = findUsedPiece(index);
  125. if(piece.isNull()) {
  126. piece.reset(new Piece(index, bitfieldMan->getBlockLength(index)));
  127. if(hasPiece(index)) {
  128. piece->setAllBlock();
  129. }
  130. }
  131. }
  132. return piece;
  133. }
  134. void DefaultPieceStorage::addUsedPiece(const PieceHandle& piece)
  135. {
  136. usedPieces.push_back(piece);
  137. }
  138. class FindPiece {
  139. private:
  140. size_t index;
  141. public:
  142. FindPiece(size_t index):index(index) {}
  143. bool operator()(const PieceHandle& piece) {
  144. return piece->getIndex() == index;
  145. }
  146. };
  147. PieceHandle DefaultPieceStorage::findUsedPiece(size_t index) const
  148. {
  149. Pieces::const_iterator itr = std::find_if(usedPieces.begin(),
  150. usedPieces.end(),
  151. FindPiece(index));
  152. if(itr == usedPieces.end()) {
  153. return SharedHandle<Piece>();
  154. } else {
  155. return *itr;
  156. }
  157. }
  158. PieceHandle DefaultPieceStorage::getMissingPiece(const PeerHandle& peer)
  159. {
  160. size_t index;
  161. if(getMissingPieceIndex(index, peer)) {
  162. return checkOutPiece(index);
  163. } else {
  164. return SharedHandle<Piece>();
  165. }
  166. }
  167. bool DefaultPieceStorage::getMissingFastPieceIndex(size_t& index,
  168. const PeerHandle& peer)
  169. {
  170. if(peer->isFastExtensionEnabled() && peer->countPeerAllowedIndexSet() > 0) {
  171. BitfieldMan tempBitfield(bitfieldMan->getBlockLength(),
  172. bitfieldMan->getTotalLength());
  173. for(std::deque<size_t>::const_iterator itr = peer->getPeerAllowedIndexSet().begin();
  174. itr != peer->getPeerAllowedIndexSet().end(); itr++) {
  175. if(!bitfieldMan->isBitSet(index) && peer->hasPiece(*itr)) {
  176. tempBitfield.setBit(*itr);
  177. }
  178. }
  179. if(isEndGame()) {
  180. return bitfieldMan->getMissingIndex(index, tempBitfield.getBitfield(),
  181. tempBitfield.getBitfieldLength());
  182. } else {
  183. return bitfieldMan->getMissingUnusedIndex(index,
  184. tempBitfield.getBitfield(),
  185. tempBitfield.getBitfieldLength());
  186. }
  187. }
  188. return false;
  189. }
  190. PieceHandle DefaultPieceStorage::getMissingFastPiece(const PeerHandle& peer)
  191. {
  192. size_t index;
  193. if(getMissingFastPieceIndex(index, peer)) {
  194. return checkOutPiece(index);
  195. } else {
  196. return SharedHandle<Piece>();
  197. }
  198. }
  199. PieceHandle DefaultPieceStorage::getMissingPiece()
  200. {
  201. size_t index;
  202. if(bitfieldMan->getSparseMissingUnusedIndex(index)) {
  203. return checkOutPiece(index);
  204. } else {
  205. return SharedHandle<Piece>();
  206. }
  207. }
  208. PieceHandle DefaultPieceStorage::getMissingPiece(size_t index)
  209. {
  210. if(hasPiece(index) || isPieceUsed(index)) {
  211. return SharedHandle<Piece>();
  212. } else {
  213. return checkOutPiece(index);
  214. }
  215. }
  216. void DefaultPieceStorage::deleteUsedPiece(const PieceHandle& piece)
  217. {
  218. if(piece.isNull()) {
  219. return;
  220. }
  221. Pieces::iterator itr = std::find(usedPieces.begin(), usedPieces.end(), piece);
  222. if(itr != usedPieces.end()) {
  223. usedPieces.erase(itr);
  224. }
  225. }
  226. void DefaultPieceStorage::reduceUsedPieces(size_t delMax)
  227. {
  228. if(usedPieces.size() <= delMax) {
  229. return;
  230. }
  231. size_t toDelete = usedPieces.size()-delMax;
  232. int fillRate = 10;
  233. while(fillRate < 50) {
  234. size_t deleted = deleteUsedPiecesByFillRate(fillRate, toDelete);
  235. if(deleted == 0) {
  236. break;
  237. }
  238. toDelete -= deleted;
  239. fillRate += 10;
  240. }
  241. }
  242. size_t DefaultPieceStorage::deleteUsedPiecesByFillRate(int fillRate,
  243. size_t toDelete)
  244. {
  245. size_t deleted = 0;
  246. for(Pieces::iterator itr = usedPieces.begin();
  247. itr != usedPieces.end() && deleted < toDelete;) {
  248. PieceHandle& piece = *itr;
  249. if(!bitfieldMan->isUseBitSet(piece->getIndex()) &&
  250. piece->countCompleteBlock() <= piece->countBlock()*(fillRate/100.0)) {
  251. logger->debug(MSG_DELETING_USED_PIECE,
  252. piece->getIndex(),
  253. (piece->countCompleteBlock()*100)/piece->countBlock(),
  254. fillRate);
  255. itr = usedPieces.erase(itr);
  256. deleted++;
  257. } else {
  258. itr++;
  259. }
  260. }
  261. return deleted;
  262. }
  263. void DefaultPieceStorage::completePiece(const PieceHandle& piece)
  264. {
  265. if(piece.isNull()) {
  266. return;
  267. }
  268. deleteUsedPiece(piece);
  269. if(!isEndGame()) {
  270. reduceUsedPieces(100);
  271. }
  272. if(allDownloadFinished()) {
  273. return;
  274. }
  275. bitfieldMan->setBit(piece->getIndex());
  276. bitfieldMan->unsetUseBit(piece->getIndex());
  277. addPieceStats(piece->getIndex());
  278. if(downloadFinished()) {
  279. diskAdaptor->onDownloadComplete();
  280. if(isSelectiveDownloadingMode()) {
  281. logger->notice(MSG_SELECTIVE_DOWNLOAD_COMPLETED);
  282. // following line was commented out in order to stop sending request
  283. // message after user-specified files were downloaded.
  284. //finishSelectiveDownloadingMode();
  285. } else {
  286. logger->info(MSG_DOWNLOAD_COMPLETED);
  287. }
  288. }
  289. }
  290. bool DefaultPieceStorage::isSelectiveDownloadingMode()
  291. {
  292. return bitfieldMan->isFilterEnabled();
  293. }
  294. void DefaultPieceStorage::finishSelectiveDownloadingMode()
  295. {
  296. bitfieldMan->clearFilter();
  297. diskAdaptor->addAllDownloadEntry();
  298. }
  299. // not unittested
  300. void DefaultPieceStorage::cancelPiece(const PieceHandle& piece)
  301. {
  302. if(piece.isNull()) {
  303. return;
  304. }
  305. bitfieldMan->unsetUseBit(piece->getIndex());
  306. if(!isEndGame()) {
  307. if(piece->getCompletedLength() == 0) {
  308. deleteUsedPiece(piece);
  309. }
  310. }
  311. }
  312. bool DefaultPieceStorage::hasPiece(size_t index)
  313. {
  314. return bitfieldMan->isBitSet(index);
  315. }
  316. bool DefaultPieceStorage::isPieceUsed(size_t index)
  317. {
  318. return bitfieldMan->isUseBitSet(index);
  319. }
  320. uint64_t DefaultPieceStorage::getTotalLength()
  321. {
  322. return bitfieldMan->getTotalLength();
  323. }
  324. uint64_t DefaultPieceStorage::getFilteredTotalLength()
  325. {
  326. return bitfieldMan->getFilteredTotalLength();
  327. }
  328. uint64_t DefaultPieceStorage::getCompletedLength()
  329. {
  330. return bitfieldMan->getCompletedLength()+getInFlightPieceCompletedLength();
  331. }
  332. uint64_t DefaultPieceStorage::getFilteredCompletedLength()
  333. {
  334. return bitfieldMan->getFilteredCompletedLength()+getInFlightPieceCompletedLength();
  335. }
  336. size_t DefaultPieceStorage::getInFlightPieceCompletedLength() const
  337. {
  338. return std::accumulate(usedPieces.begin(), usedPieces.end(), 0, adopt2nd(std::plus<size_t>(), mem_fun_sh(&Piece::getCompletedLength)));
  339. }
  340. // not unittested
  341. void DefaultPieceStorage::setFileFilter(const std::deque<std::string>& filePaths)
  342. {
  343. if(downloadContext->getFileMode() != DownloadContext::MULTI || filePaths.empty()) {
  344. return;
  345. }
  346. diskAdaptor->removeAllDownloadEntry();
  347. for(std::deque<std::string>::const_iterator pitr = filePaths.begin();
  348. pitr != filePaths.end(); pitr++) {
  349. if(!diskAdaptor->addDownloadEntry(*pitr)) {
  350. throw DlAbortEx(StringFormat(EX_NO_SUCH_FILE_ENTRY, (*pitr).c_str()).str());
  351. }
  352. FileEntryHandle fileEntry = diskAdaptor->getFileEntryFromPath(*pitr);
  353. bitfieldMan->addFilter(fileEntry->getOffset(), fileEntry->getLength());
  354. }
  355. bitfieldMan->enableFilter();
  356. }
  357. void DefaultPieceStorage::setFileFilter(IntSequence seq)
  358. {
  359. std::deque<int32_t> fileIndexes = seq.flush();
  360. // TODO Is sorting necessary?
  361. std::sort(fileIndexes.begin(), fileIndexes.end());
  362. fileIndexes.erase(std::unique(fileIndexes.begin(), fileIndexes.end()), fileIndexes.end());
  363. std::deque<std::string> filePaths;
  364. const FileEntries& entries = diskAdaptor->getFileEntries();
  365. for(size_t i = 0; i < entries.size(); i++) {
  366. if(std::find(fileIndexes.begin(), fileIndexes.end(), i+1) != fileIndexes.end()) {
  367. logger->debug("index=%d is %s", i+1, entries[i]->getPath().c_str());
  368. filePaths.push_back(entries[i]->getPath());
  369. }
  370. }
  371. setFileFilter(filePaths);
  372. }
  373. // not unittested
  374. void DefaultPieceStorage::clearFileFilter()
  375. {
  376. bitfieldMan->clearFilter();
  377. diskAdaptor->addAllDownloadEntry();
  378. }
  379. // not unittested
  380. bool DefaultPieceStorage::downloadFinished()
  381. {
  382. // TODO iterate all requested FileEntry and Call bitfieldMan->isBitSetOffsetRange()
  383. return bitfieldMan->isFilteredAllBitSet();
  384. }
  385. // not unittested
  386. bool DefaultPieceStorage::allDownloadFinished()
  387. {
  388. return bitfieldMan->isAllBitSet();
  389. }
  390. // not unittested
  391. void DefaultPieceStorage::initStorage()
  392. {
  393. if(downloadContext->getFileMode() == DownloadContext::SINGLE) {
  394. logger->debug("Instantiating DirectDiskAdaptor");
  395. DiskWriterHandle writer = _diskWriterFactory->newDiskWriter();
  396. writer->setDirectIOAllowed(option->getAsBool(PREF_ENABLE_DIRECT_IO));
  397. DirectDiskAdaptorHandle directDiskAdaptor(new DirectDiskAdaptor());
  398. directDiskAdaptor->setDiskWriter(writer);
  399. directDiskAdaptor->setTotalLength(downloadContext->getTotalLength());
  400. this->diskAdaptor = directDiskAdaptor;
  401. } else {
  402. // file mode == DownloadContext::MULTI
  403. if(option->getAsBool(PREF_DIRECT_FILE_MAPPING)) {
  404. logger->debug("Instantiating MultiDiskAdaptor");
  405. MultiDiskAdaptorHandle multiDiskAdaptor(new MultiDiskAdaptor());
  406. multiDiskAdaptor->setDirectIOAllowed(option->getAsBool(PREF_ENABLE_DIRECT_IO));
  407. multiDiskAdaptor->setPieceLength(downloadContext->getPieceLength());
  408. multiDiskAdaptor->setTopDir(downloadContext->getName());
  409. this->diskAdaptor = multiDiskAdaptor;
  410. } else {
  411. logger->debug("Instantiating CopyDiskAdaptor");
  412. DiskWriterHandle writer = _diskWriterFactory->newDiskWriter();
  413. writer->setDirectIOAllowed(option->getAsBool(PREF_ENABLE_DIRECT_IO));
  414. CopyDiskAdaptorHandle copyDiskAdaptor(new CopyDiskAdaptor());
  415. copyDiskAdaptor->setDiskWriter(writer);
  416. copyDiskAdaptor->setTempFilename(downloadContext->getName()+".a2tmp");
  417. copyDiskAdaptor->setTotalLength(downloadContext->getTotalLength());
  418. if(downloadContext->getFileMode() == DownloadContext::MULTI) {
  419. copyDiskAdaptor->setTopDir(downloadContext->getName());
  420. }
  421. this->diskAdaptor = copyDiskAdaptor;
  422. }
  423. }
  424. diskAdaptor->setStoreDir(downloadContext->getDir());
  425. diskAdaptor->setFileEntries(downloadContext->getFileEntries());
  426. }
  427. void DefaultPieceStorage::setBitfield(const unsigned char* bitfield,
  428. size_t bitfieldLength)
  429. {
  430. bitfieldMan->setBitfield(bitfield, bitfieldLength);
  431. addPieceStats(bitfield, bitfieldLength);
  432. }
  433. size_t DefaultPieceStorage::getBitfieldLength()
  434. {
  435. return bitfieldMan->getBitfieldLength();
  436. }
  437. const unsigned char* DefaultPieceStorage::getBitfield()
  438. {
  439. return bitfieldMan->getBitfield();
  440. }
  441. DiskAdaptorHandle DefaultPieceStorage::getDiskAdaptor() {
  442. return diskAdaptor;
  443. }
  444. size_t DefaultPieceStorage::getPieceLength(size_t index)
  445. {
  446. return bitfieldMan->getBlockLength(index);
  447. }
  448. void DefaultPieceStorage::advertisePiece(int32_t cuid, size_t index)
  449. {
  450. HaveEntry entry(cuid, index);
  451. haves.push_front(entry);
  452. }
  453. void
  454. DefaultPieceStorage::getAdvertisedPieceIndexes(std::deque<size_t>& indexes,
  455. int32_t myCuid,
  456. const Time& lastCheckTime)
  457. {
  458. for(Haves::const_iterator itr = haves.begin(); itr != haves.end(); itr++) {
  459. const Haves::value_type& have = *itr;
  460. if(have.getCuid() == myCuid) {
  461. continue;
  462. }
  463. if(lastCheckTime.isNewer(have.getRegisteredTime())) {
  464. break;
  465. }
  466. indexes.push_back(have.getIndex());
  467. }
  468. }
  469. class FindElapsedHave
  470. {
  471. private:
  472. time_t elapsed;
  473. public:
  474. FindElapsedHave(time_t elapsed):elapsed(elapsed) {}
  475. bool operator()(const HaveEntry& have) {
  476. if(have.getRegisteredTime().elapsed(elapsed)) {
  477. return true;
  478. } else {
  479. return false;
  480. }
  481. }
  482. };
  483. void DefaultPieceStorage::removeAdvertisedPiece(time_t elapsed)
  484. {
  485. Haves::iterator itr =
  486. std::find_if(haves.begin(), haves.end(), FindElapsedHave(elapsed));
  487. if(itr != haves.end()) {
  488. logger->debug(MSG_REMOVED_HAVE_ENTRY, haves.end()-itr);
  489. haves.erase(itr, haves.end());
  490. }
  491. }
  492. void DefaultPieceStorage::markAllPiecesDone()
  493. {
  494. bitfieldMan->setAllBit();
  495. }
  496. void DefaultPieceStorage::markPiecesDone(uint64_t length)
  497. {
  498. if(length == bitfieldMan->getTotalLength()) {
  499. bitfieldMan->setAllBit();
  500. } else {
  501. size_t numPiece = length/bitfieldMan->getBlockLength();
  502. if(numPiece > 0) {
  503. bitfieldMan->setBitRange(0, numPiece-1);
  504. }
  505. size_t r = (length%bitfieldMan->getBlockLength())/Piece::BLOCK_LENGTH;
  506. if(r > 0) {
  507. PieceHandle p(new Piece(numPiece, bitfieldMan->getBlockLength(numPiece)));
  508. for(size_t i = 0; i < r; ++i) {
  509. p->completeBlock(i);
  510. }
  511. addUsedPiece(p);
  512. }
  513. }
  514. }
  515. void DefaultPieceStorage::markPieceMissing(size_t index)
  516. {
  517. bitfieldMan->unsetBit(index);
  518. }
  519. void DefaultPieceStorage::addInFlightPiece(const Pieces& pieces)
  520. {
  521. usedPieces.insert(usedPieces.end(), pieces.begin(), pieces.end());
  522. }
  523. size_t DefaultPieceStorage::countInFlightPiece()
  524. {
  525. return usedPieces.size();
  526. }
  527. void DefaultPieceStorage::getInFlightPieces(std::deque<SharedHandle<Piece> >& pieces)
  528. {
  529. pieces.insert(pieces.end(), usedPieces.begin(), usedPieces.end());
  530. }
  531. void DefaultPieceStorage::setDiskWriterFactory(const DiskWriterFactoryHandle& diskWriterFactory)
  532. {
  533. _diskWriterFactory = diskWriterFactory;
  534. }
  535. void DefaultPieceStorage::addPieceStats(const unsigned char* bitfield,
  536. size_t bitfieldLength)
  537. {
  538. _pieceSelector->addPieceStats(bitfield, bitfieldLength);
  539. }
  540. void DefaultPieceStorage::subtractPieceStats(const unsigned char* bitfield,
  541. size_t bitfieldLength)
  542. {
  543. _pieceSelector->subtractPieceStats(bitfield, bitfieldLength);
  544. }
  545. void DefaultPieceStorage::updatePieceStats(const unsigned char* newBitfield,
  546. size_t newBitfieldLength,
  547. const unsigned char* oldBitfield)
  548. {
  549. _pieceSelector->updatePieceStats(newBitfield, newBitfieldLength,
  550. oldBitfield);
  551. }
  552. void DefaultPieceStorage::addPieceStats(size_t index)
  553. {
  554. _pieceSelector->addPieceStats(index);
  555. }
  556. } // namespace aria2