~ubuntu-branches/ubuntu/quantal/aria2/quantal

« back to all changes in this revision

Viewing changes to src/FileEntry.cc

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2011-04-02 12:38:55 UTC
  • mfrom: (2.5.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110402123855-znkslovhf5qvkjut
Tags: 1.11.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        break;
171
171
      }
172
172
    }
173
 
  } else {    
174
 
    req = requestPool_.front();
175
 
    requestPool_.pop_front();
 
173
  } else {
 
174
    // Skip Request object if it is still
 
175
    // sleeping(Request::getWakeTime() < global::wallclock).  If all
 
176
    // pooled objects are sleeping, return first one.  Caller should
 
177
    // inspect returned object's getWakeTime().
 
178
    std::deque<SharedHandle<Request> >::iterator i = requestPool_.begin();
 
179
    std::deque<SharedHandle<Request> >::iterator eoi = requestPool_.end();
 
180
    for(; i != eoi; ++i) {
 
181
      if((*i)->getWakeTime() <= global::wallclock) {
 
182
        break;
 
183
      }
 
184
    }
 
185
    if(i == eoi) {
 
186
      i = requestPool_.begin();
 
187
    }
 
188
    req = *i;
 
189
    requestPool_.erase(i);
176
190
    inFlightRequests_.push_back(req);
177
191
    A2_LOG_DEBUG(fmt("Picked up from pool: %s", req->getUri().c_str()));
178
192
  }