~ubuntu-branches/ubuntu/wily/aria2/wily-proposed

« back to all changes in this revision

Viewing changes to src/StreamFileAllocationEntry.cc

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Kartik Mistry, Patrick Ruckstuhl
  • Date: 2013-09-22 18:52:14 UTC
  • mfrom: (2.5.19 sid)
  • Revision ID: package-import@ubuntu.com-20130922185214-upeu2ljgeqi7e7oo
Tags: 1.18.0-1
[ Kartik Mistry ]
* New upstream release.
* debian/control:
  + (really) Set priority to optional from extra (Closes: #697659).
  + wrap-and-sort some fields.

[ Patrick Ruckstuhl ]
* debian/rules:
  + Allow parallel building (Closes: #720977)
* debian/tests, debian/control:
  + autopkgtest infrastructure

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 
50
50
namespace aria2 {
51
51
 
52
 
StreamFileAllocationEntry::StreamFileAllocationEntry(RequestGroup* requestGroup,
53
 
                                                     Command* nextCommand):
54
 
  FileAllocationEntry(requestGroup, nextCommand)
 
52
StreamFileAllocationEntry::StreamFileAllocationEntry
 
53
(RequestGroup* requestGroup, std::unique_ptr<Command> nextCommand):
 
54
  FileAllocationEntry(requestGroup, std::move(nextCommand))
55
55
{}
56
56
 
57
57
StreamFileAllocationEntry::~StreamFileAllocationEntry() {}
58
58
 
59
59
void StreamFileAllocationEntry::prepareForNextAction
60
 
(std::vector<Command*>& commands,
 
60
(std::vector<std::unique_ptr<Command>>& commands,
61
61
 DownloadEngine* e)
62
62
{
63
63
  // For DownloadContext::resetDownloadStartTime(), see also
69
69
  if(getNextCommand()) {
70
70
    // Reset download start time of PeerStat because it is started
71
71
    // before file allocation begins.
72
 
    const SharedHandle<DownloadContext>& dctx =
 
72
    const std::shared_ptr<DownloadContext>& dctx =
73
73
      getRequestGroup()->getDownloadContext();
74
 
    const std::vector<SharedHandle<FileEntry> >& fileEntries =
 
74
    const std::vector<std::shared_ptr<FileEntry> >& fileEntries =
75
75
      dctx->getFileEntries();
76
 
    for(std::vector<SharedHandle<FileEntry> >::const_iterator i =
77
 
          fileEntries.begin(), eoi = fileEntries.end(); i != eoi; ++i) {
78
 
      const FileEntry::InFlightRequestSet& reqs =
79
 
        (*i)->getInFlightRequests();
80
 
      for(FileEntry::InFlightRequestSet::iterator j =
81
 
            reqs.begin(), eoj = reqs.end(); j != eoj; ++j) {
82
 
        const SharedHandle<PeerStat>& peerStat = (*j)->getPeerStat();
 
76
    for(auto & f : fileEntries) {
 
77
      const auto& reqs = f->getInFlightRequests();
 
78
      for(auto & req : reqs) {
 
79
        const std::shared_ptr<PeerStat>& peerStat = req->getPeerStat();
83
80
        if(peerStat) {
84
81
          peerStat->downloadStart();
85
82
        }