mirror of https://github.com/aria2/aria2
2010-08-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed getMissingFastPiece(piece) and getMissingFastPiece(piece, excludedIndexes) from PieceStorage. Done some code cleanup. * src/DefaultPieceStorage.h * src/PieceStorage.h * src/UnknownLengthPieceStorage.cc * src/UnknownLengthPieceStorage.h * test/MockPieceStorage.hpull/1/head
parent
4b2d1deff6
commit
0968d4fedd
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2010-08-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed getMissingFastPiece(piece) and getMissingFastPiece(piece,
|
||||
excludedIndexes) from PieceStorage. Done some code cleanup.
|
||||
* src/DefaultPieceStorage.h
|
||||
* src/PieceStorage.h
|
||||
* src/UnknownLengthPieceStorage.cc
|
||||
* src/UnknownLengthPieceStorage.h
|
||||
* test/MockPieceStorage.h
|
||||
|
||||
2010-08-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Pass excludedIndexes when getting metadata piece.
|
||||
|
|
|
@ -124,15 +124,9 @@ public:
|
|||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes);
|
||||
const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
|
@ -143,15 +137,21 @@ public:
|
|||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes);
|
||||
|
||||
virtual SharedHandle<Piece> getMissingPiece(const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual SharedHandle<Piece> getMissingFastPiece
|
||||
(const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual SharedHandle<Piece> getMissingPiece
|
||||
virtual SharedHandle<Piece> getMissingPiece
|
||||
(const SharedHandle<Peer>& peer, const std::vector<size_t>& excludedIndexes);
|
||||
|
||||
virtual SharedHandle<Piece> getMissingFastPiece
|
||||
SharedHandle<Piece> getMissingFastPiece
|
||||
(const SharedHandle<Peer>& peer);
|
||||
|
||||
SharedHandle<Piece> getMissingFastPiece
|
||||
(const SharedHandle<Peer>& peer, const std::vector<size_t>& excludedIndexes);
|
||||
|
||||
#endif // ENABLE_BITTORRENT
|
||||
|
|
|
@ -63,28 +63,49 @@ public:
|
|||
*/
|
||||
virtual bool hasMissingPiece(const SharedHandle<Peer>& peer) = 0;
|
||||
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes) = 0;
|
||||
|
||||
// Stores pieces that the peer has but localhost doesn't. Those
|
||||
// pieces will be marked "used" status in order to prevent other
|
||||
// command from get the same piece. But in end game mode, same
|
||||
// piece may be got by several commands. This function stores N
|
||||
// pieces where the sum of missing block of first N-1 pieces is
|
||||
// less than minMissingBlocks and the sum of missing block of N
|
||||
// pieces is greater than or equal to minMissingBlocks. If there is
|
||||
// M missing pieces left where M < N, M pieces are stored.
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer) = 0;
|
||||
|
||||
// Same as getMissingPiece(pieces, minMissingBlocks, peer), but the
|
||||
// indexes in excludedIndexes are excluded.
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes) = 0;
|
||||
|
||||
// Stores pieces that the peer has but localhost doesn't. Only
|
||||
// pieces that declared as "fast" are stored. Those pieces stored
|
||||
// will be marked "used" status in order to prevent other command
|
||||
// from get the same piece. But in end game mode, same piece may be
|
||||
// got by several commands. This function stores N pieces where the
|
||||
// sum of missing block of first N-1 pieces is less than
|
||||
// minMissingBlocks and the sum of missing block of N pieces is
|
||||
// greater than or equal to minMissingBlocks. If there is M missing
|
||||
// pieces left where M < N, M pieces are stored.
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer) = 0;
|
||||
|
||||
// Same as getMissingFastPiece(pieces, minMissingBlocks, peer), but
|
||||
// the indexes in excludedIndexes are excluded.
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes) = 0;
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer) = 0;
|
||||
|
||||
/**
|
||||
* Returns a piece that the peer has but localhost doesn't.
|
||||
* The piece will be marked "used" status in order to prevent other command
|
||||
|
@ -101,25 +122,6 @@ public:
|
|||
virtual SharedHandle<Piece> getMissingPiece
|
||||
(const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes) = 0;
|
||||
|
||||
/**
|
||||
* Returns a piece that the peer has but localhost doesn't.
|
||||
* Only pieces that declared as "fast" are returned.
|
||||
* The piece will be marked "used" status in order to prevent other command
|
||||
* from get the same piece. But in end game mode, same piece may be returned
|
||||
* to several commands.
|
||||
*/
|
||||
virtual SharedHandle<Piece>
|
||||
getMissingFastPiece(const SharedHandle<Peer>& peer) = 0;
|
||||
|
||||
/**
|
||||
* Same as getMissingFastPiece(const SharedHandle<Peer>& peer), but the
|
||||
* indexes in excludedIndexes are excluded.
|
||||
*/
|
||||
virtual SharedHandle<Piece> getMissingFastPiece
|
||||
(const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes) = 0;
|
||||
|
||||
#endif // ENABLE_BITTORRENT
|
||||
|
||||
// Returns true if there is at least one missing and unused piece.
|
||||
|
|
|
@ -81,21 +81,12 @@ bool UnknownLengthPieceStorage::hasMissingPiece(const SharedHandle<Peer>& peer)
|
|||
void UnknownLengthPieceStorage::getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes)
|
||||
const SharedHandle<Peer>& peer)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
void UnknownLengthPieceStorage::getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
void UnknownLengthPieceStorage::getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
|
@ -112,6 +103,15 @@ void UnknownLengthPieceStorage::getMissingFastPiece
|
|||
abort();
|
||||
}
|
||||
|
||||
void UnknownLengthPieceStorage::getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
SharedHandle<Piece> UnknownLengthPieceStorage::getMissingPiece(const SharedHandle<Peer>& peer)
|
||||
{
|
||||
abort();
|
||||
|
@ -122,18 +122,6 @@ SharedHandle<Piece> UnknownLengthPieceStorage::getMissingPiece
|
|||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
SharedHandle<Piece> UnknownLengthPieceStorage::getMissingFastPiece(const SharedHandle<Peer>& peer)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
SharedHandle<Piece> UnknownLengthPieceStorage::getMissingFastPiece
|
||||
(const SharedHandle<Peer>& peer, const std::vector<size_t>& excludedIndexes)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif // ENABLE_BITTORRENT
|
||||
|
||||
bool UnknownLengthPieceStorage::hasMissingUnusedPiece()
|
||||
|
|
|
@ -76,15 +76,9 @@ public:
|
|||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes);
|
||||
const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
|
@ -95,29 +89,16 @@ public:
|
|||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer);
|
||||
|
||||
/**
|
||||
* Returns a piece that the peer has but localhost doesn't.
|
||||
* The piece will be marked "used" status in order to prevent other command
|
||||
* from get the same piece. But in end game mode, same piece may be returned
|
||||
* to several commands.
|
||||
*/
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes);
|
||||
|
||||
virtual SharedHandle<Piece> getMissingPiece(const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual SharedHandle<Piece> getMissingPiece
|
||||
(const SharedHandle<Peer>& peer, const std::vector<size_t>& excludedIndexes);
|
||||
|
||||
/**
|
||||
* Returns a piece that the peer has but localhost doesn't.
|
||||
* Only pieces that declared as "fast" are returned.
|
||||
* The piece will be marked "used" status in order to prevent other command
|
||||
* from get the same piece. But in end game mode, same piece may be returned
|
||||
* to several commands.
|
||||
*/
|
||||
virtual SharedHandle<Piece> getMissingFastPiece(const SharedHandle<Peer>& peer);
|
||||
|
||||
virtual SharedHandle<Piece> getMissingFastPiece
|
||||
(const SharedHandle<Peer>& peer, const std::vector<size_t>& excludedIndexes);
|
||||
|
||||
#endif // ENABLE_BITTORRENT
|
||||
|
||||
virtual bool hasMissingUnusedPiece();
|
||||
|
|
|
@ -44,52 +44,42 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer)
|
||||
{}
|
||||
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes)
|
||||
{}
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer)
|
||||
{}
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes)
|
||||
{}
|
||||
|
||||
virtual SharedHandle<Piece> getMissingPiece(const SharedHandle<Peer>& peer) {
|
||||
return SharedHandle<Piece>(new Piece());
|
||||
}
|
||||
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes)
|
||||
{}
|
||||
|
||||
virtual void getMissingPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer)
|
||||
{}
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer,
|
||||
const std::vector<size_t>& excludedIndexes)
|
||||
{}
|
||||
|
||||
virtual void getMissingFastPiece
|
||||
(std::vector<SharedHandle<Piece> >& pieces,
|
||||
size_t minMissingBlocks,
|
||||
const SharedHandle<Peer>& peer)
|
||||
{}
|
||||
|
||||
virtual SharedHandle<Piece> getMissingPiece
|
||||
(const SharedHandle<Peer>& peer, const std::vector<size_t>& excludedIndexes)
|
||||
{
|
||||
return SharedHandle<Piece>(new Piece());
|
||||
}
|
||||
|
||||
virtual SharedHandle<Piece> getMissingFastPiece(const SharedHandle<Peer>& peer) {
|
||||
return SharedHandle<Piece>(new Piece());
|
||||
}
|
||||
|
||||
virtual SharedHandle<Piece> getMissingFastPiece
|
||||
(const SharedHandle<Peer>& peer, const std::vector<size_t>& excludedIndexes)
|
||||
{
|
||||
return SharedHandle<Piece>(new Piece());
|
||||
}
|
||||
|
||||
#endif // ENABLE_BITTORRENT
|
||||
|
||||
virtual bool hasMissingUnusedPiece()
|
||||
|
|
Loading…
Reference in New Issue