mirror of https://github.com/aria2/aria2
2008-05-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Replaced std:copy with insert. * src/DefaultBtMessageDispatcher.cc * src/DefaultPieceStorage.cc * src/DownloadEngineFactory.cc * src/RequestGroup.ccpull/1/head
parent
111edd2c56
commit
e4b0446c61
|
@ -1,3 +1,11 @@
|
||||||
|
2008-05-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Replaced std:copy with insert.
|
||||||
|
* src/DefaultBtMessageDispatcher.cc
|
||||||
|
* src/DefaultPieceStorage.cc
|
||||||
|
* src/DownloadEngineFactory.cc
|
||||||
|
* src/RequestGroup.cc
|
||||||
|
|
||||||
2008-05-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-05-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Included SocketCore.h to fix compiler warning.
|
Included SocketCore.h to fix compiler warning.
|
||||||
|
|
|
@ -98,7 +98,7 @@ void DefaultBtMessageDispatcher::sendMessages() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::copy(tempQueue.begin(), tempQueue.end(), std::back_inserter(messageQueue));
|
messageQueue.insert(messageQueue.end(), tempQueue.begin(), tempQueue.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
class HandleEvent {
|
class HandleEvent {
|
||||||
|
|
|
@ -570,7 +570,7 @@ void DefaultPieceStorage::markPieceMissing(size_t index)
|
||||||
|
|
||||||
void DefaultPieceStorage::addInFlightPiece(const Pieces& pieces)
|
void DefaultPieceStorage::addInFlightPiece(const Pieces& pieces)
|
||||||
{
|
{
|
||||||
std::copy(pieces.begin(), pieces.end(), std::back_inserter(usedPieces));
|
usedPieces.insert(usedPieces.end(), pieces.begin(), pieces.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DefaultPieceStorage::countInFlightPiece()
|
size_t DefaultPieceStorage::countInFlightPiece()
|
||||||
|
|
|
@ -64,10 +64,15 @@ DownloadEngineFactory::newDownloadEngine(Option* op,
|
||||||
{
|
{
|
||||||
RequestGroups workingSet;
|
RequestGroups workingSet;
|
||||||
RequestGroups reservedSet;
|
RequestGroups reservedSet;
|
||||||
if((size_t)op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS) < requestGroups.size()) {
|
const size_t MAX_CONCURRENT_DOWNLOADS = op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS);
|
||||||
std::copy(requestGroups.begin(), requestGroups.begin()+op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS), std::back_inserter(workingSet));
|
if(MAX_CONCURRENT_DOWNLOADS < requestGroups.size()) {
|
||||||
std::copy(requestGroups.begin()+op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS),
|
workingSet.insert(workingSet.end(),
|
||||||
requestGroups.end(), std::back_inserter(reservedSet));
|
requestGroups.begin(),
|
||||||
|
requestGroups.begin()+MAX_CONCURRENT_DOWNLOADS);
|
||||||
|
|
||||||
|
reservedSet.insert(reservedSet.end(),
|
||||||
|
requestGroups.begin()+MAX_CONCURRENT_DOWNLOADS,
|
||||||
|
requestGroups.end());
|
||||||
} else {
|
} else {
|
||||||
workingSet = requestGroups;
|
workingSet = requestGroups;
|
||||||
}
|
}
|
||||||
|
@ -75,8 +80,7 @@ DownloadEngineFactory::newDownloadEngine(Option* op,
|
||||||
DownloadEngineHandle e(new DownloadEngine());
|
DownloadEngineHandle e(new DownloadEngine());
|
||||||
e->option = op;
|
e->option = op;
|
||||||
RequestGroupManHandle
|
RequestGroupManHandle
|
||||||
requestGroupMan(new RequestGroupMan(workingSet,
|
requestGroupMan(new RequestGroupMan(workingSet, MAX_CONCURRENT_DOWNLOADS));
|
||||||
op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS)));
|
|
||||||
requestGroupMan->addReservedGroup(reservedSet);
|
requestGroupMan->addReservedGroup(reservedSet);
|
||||||
e->_requestGroupMan = requestGroupMan;
|
e->_requestGroupMan = requestGroupMan;
|
||||||
e->_fileAllocationMan.reset(new FileAllocationMan());
|
e->_fileAllocationMan.reset(new FileAllocationMan());
|
||||||
|
|
|
@ -505,13 +505,13 @@ void RequestGroup::createNextCommand(std::deque<Command*>& commands,
|
||||||
command->setStatus(Command::STATUS_ONESHOT_REALTIME);
|
command->setStatus(Command::STATUS_ONESHOT_REALTIME);
|
||||||
commands.push_back(command);
|
commands.push_back(command);
|
||||||
} else {
|
} else {
|
||||||
pendingURIs.push_front(uri);
|
pendingURIs.push_back(uri);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_logger->error(MSG_UNRECOGNIZED_URI, req->getUrl().c_str());
|
_logger->error(MSG_UNRECOGNIZED_URI, req->getUrl().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::copy(pendingURIs.begin(), pendingURIs.end(), std::front_inserter(_uris));
|
_uris.insert(_uris.begin(), pendingURIs.begin(), pendingURIs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RequestGroup::getFilePath() const
|
std::string RequestGroup::getFilePath() const
|
||||||
|
|
Loading…
Reference in New Issue