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>
|
||||
|
||||
Included SocketCore.h to fix compiler warning.
|
||||
|
|
|
@ -98,7 +98,7 @@ void DefaultBtMessageDispatcher::sendMessages() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
std::copy(tempQueue.begin(), tempQueue.end(), std::back_inserter(messageQueue));
|
||||
messageQueue.insert(messageQueue.end(), tempQueue.begin(), tempQueue.end());
|
||||
}
|
||||
|
||||
class HandleEvent {
|
||||
|
|
|
@ -570,7 +570,7 @@ void DefaultPieceStorage::markPieceMissing(size_t index)
|
|||
|
||||
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()
|
||||
|
|
|
@ -64,10 +64,15 @@ DownloadEngineFactory::newDownloadEngine(Option* op,
|
|||
{
|
||||
RequestGroups workingSet;
|
||||
RequestGroups reservedSet;
|
||||
if((size_t)op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS) < requestGroups.size()) {
|
||||
std::copy(requestGroups.begin(), requestGroups.begin()+op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS), std::back_inserter(workingSet));
|
||||
std::copy(requestGroups.begin()+op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS),
|
||||
requestGroups.end(), std::back_inserter(reservedSet));
|
||||
const size_t MAX_CONCURRENT_DOWNLOADS = op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS);
|
||||
if(MAX_CONCURRENT_DOWNLOADS < requestGroups.size()) {
|
||||
workingSet.insert(workingSet.end(),
|
||||
requestGroups.begin(),
|
||||
requestGroups.begin()+MAX_CONCURRENT_DOWNLOADS);
|
||||
|
||||
reservedSet.insert(reservedSet.end(),
|
||||
requestGroups.begin()+MAX_CONCURRENT_DOWNLOADS,
|
||||
requestGroups.end());
|
||||
} else {
|
||||
workingSet = requestGroups;
|
||||
}
|
||||
|
@ -75,8 +80,7 @@ DownloadEngineFactory::newDownloadEngine(Option* op,
|
|||
DownloadEngineHandle e(new DownloadEngine());
|
||||
e->option = op;
|
||||
RequestGroupManHandle
|
||||
requestGroupMan(new RequestGroupMan(workingSet,
|
||||
op->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS)));
|
||||
requestGroupMan(new RequestGroupMan(workingSet, MAX_CONCURRENT_DOWNLOADS));
|
||||
requestGroupMan->addReservedGroup(reservedSet);
|
||||
e->_requestGroupMan = requestGroupMan;
|
||||
e->_fileAllocationMan.reset(new FileAllocationMan());
|
||||
|
|
|
@ -505,13 +505,13 @@ void RequestGroup::createNextCommand(std::deque<Command*>& commands,
|
|||
command->setStatus(Command::STATUS_ONESHOT_REALTIME);
|
||||
commands.push_back(command);
|
||||
} else {
|
||||
pendingURIs.push_front(uri);
|
||||
pendingURIs.push_back(uri);
|
||||
}
|
||||
} else {
|
||||
_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
|
||||
|
|
Loading…
Reference in New Issue