mirror of https://github.com/aria2/aria2
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Call RequestGroup::createNextCommandWithAdj() from BtFileAllocationEntry if at least one FileEntry has URI. The static function hasAssociatedUri in RequestGroup.cc is renamed as isUriSuppliedForRequsetFileEntry() and placed in FileEntry.h. * src/BtFileAllocationEntry.cc * src/FileEntry.h * src/RequestGroup.ccpull/1/head
parent
f8fd518229
commit
24d258cf66
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Call RequestGroup::createNextCommandWithAdj() from
|
||||||
|
BtFileAllocationEntry if at least one FileEntry has URI. The
|
||||||
|
static function hasAssociatedUri in RequestGroup.cc is renamed as
|
||||||
|
isUriSuppliedForRequsetFileEntry() and placed in FileEntry.h.
|
||||||
|
* src/BtFileAllocationEntry.cc
|
||||||
|
* src/FileEntry.h
|
||||||
|
* src/RequestGroup.cc
|
||||||
|
|
||||||
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Generate peer ID after SimpleRandomizer is initialized.
|
Generate peer ID after SimpleRandomizer is initialized.
|
||||||
|
|
|
@ -55,8 +55,12 @@ void BtFileAllocationEntry::prepareForNextAction(std::deque<Command*>& commands,
|
||||||
BtSetup().setup(commands, _requestGroup, e, _requestGroup->getOption().get());
|
BtSetup().setup(commands, _requestGroup, e, _requestGroup->getOption().get());
|
||||||
if(!_requestGroup->downloadFinished()) {
|
if(!_requestGroup->downloadFinished()) {
|
||||||
_requestGroup->getDownloadContext()->resetDownloadStartTime();
|
_requestGroup->getDownloadContext()->resetDownloadStartTime();
|
||||||
|
const std::vector<SharedHandle<FileEntry> >& fileEntries =
|
||||||
|
_requestGroup->getDownloadContext()->getFileEntries();
|
||||||
|
if(isUriSuppliedForRequsetFileEntry(fileEntries.begin(), fileEntries.end())) {
|
||||||
_requestGroup->createNextCommandWithAdj(commands, e, 0);
|
_requestGroup->createNextCommandWithAdj(commands, e, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -265,6 +265,18 @@ size_t countRequestedFileEntry(InputIterator first, InputIterator last)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if at least one requested FileEntry has URIs.
|
||||||
|
template<typename InputIterator>
|
||||||
|
bool isUriSuppliedForRequsetFileEntry(InputIterator first, InputIterator last)
|
||||||
|
{
|
||||||
|
for(; first != last; ++first) {
|
||||||
|
if((*first)->isRequested() && !(*first)->getRemainingUris().empty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Writes first filename to given o. If memory is true, the output is
|
// Writes first filename to given o. If memory is true, the output is
|
||||||
// "[MEMORY]" plus the basename of the first filename. If there is no
|
// "[MEMORY]" plus the basename of the first filename. If there is no
|
||||||
// FileEntry, writes "n/a" to o. If more than 1 FileEntry are in the
|
// FileEntry, writes "n/a" to o. If more than 1 FileEntry are in the
|
||||||
|
|
|
@ -398,17 +398,6 @@ void RequestGroup::processCheckIntegrityEntry(std::deque<Command*>& commands,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename InputIterator>
|
|
||||||
static bool hasAssociatedUri(InputIterator first, InputIterator last)
|
|
||||||
{
|
|
||||||
for(; first != last; ++first) {
|
|
||||||
if((*first)->isRequested() && !(*first)->getRemainingUris().empty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RequestGroup::initPieceStorage()
|
void RequestGroup::initPieceStorage()
|
||||||
{
|
{
|
||||||
if(_downloadContext->knowsTotalLength()) {
|
if(_downloadContext->knowsTotalLength()) {
|
||||||
|
@ -418,7 +407,8 @@ void RequestGroup::initPieceStorage()
|
||||||
// Use LongestSequencePieceSelector when HTTP/FTP/BitTorrent integrated
|
// Use LongestSequencePieceSelector when HTTP/FTP/BitTorrent integrated
|
||||||
// downloads. Currently multi-file integrated download is not supported.
|
// downloads. Currently multi-file integrated download is not supported.
|
||||||
if(_downloadContext->hasAttribute(bittorrent::BITTORRENT) &&
|
if(_downloadContext->hasAttribute(bittorrent::BITTORRENT) &&
|
||||||
hasAssociatedUri(_downloadContext->getFileEntries().begin(),
|
isUriSuppliedForRequsetFileEntry
|
||||||
|
(_downloadContext->getFileEntries().begin(),
|
||||||
_downloadContext->getFileEntries().end())) {
|
_downloadContext->getFileEntries().end())) {
|
||||||
_logger->debug("Using LongestSequencePieceSelector");
|
_logger->debug("Using LongestSequencePieceSelector");
|
||||||
ps->setPieceSelector
|
ps->setPieceSelector
|
||||||
|
@ -635,7 +625,6 @@ void RequestGroup::createNextCommand(std::deque<Command*>& commands,
|
||||||
|
|
||||||
for(; numCommand--; ) {
|
for(; numCommand--; ) {
|
||||||
Command* command = new CreateRequestCommand(e->newCUID(), this, e);
|
Command* command = new CreateRequestCommand(e->newCUID(), this, e);
|
||||||
_logger->debug("filePath=%s", _downloadContext->getFileEntries().front()->getPath().c_str());
|
|
||||||
commands.push_back(command);
|
commands.push_back(command);
|
||||||
}
|
}
|
||||||
if(!commands.empty()) {
|
if(!commands.empty()) {
|
||||||
|
|
Loading…
Reference in New Issue