From 45430983d871b5d82ee01ca1cf0cf9437add4f3a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 28 Jun 2011 22:38:31 +0900 Subject: [PATCH] Move URI to spendUris_ when it is selected in FileEntry::findFasterRequest(). --- src/FileEntry.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/FileEntry.cc b/src/FileEntry.cc index 861f9808..355883f5 100644 --- a/src/FileEntry.cc +++ b/src/FileEntry.cc @@ -271,11 +271,14 @@ FileEntry::findFasterRequest } } if(!fastCands.empty()) { - A2_LOG_DEBUG("Selected from fastCands"); std::sort(fastCands.begin(), fastCands.end(), ServerStatFaster()); SharedHandle fastestRequest(new Request()); - fastestRequest->setUri(fastCands.front().second); + const std::string& uri = fastCands.front().second; + A2_LOG_DEBUG(fmt("Selected %s from fastCands", uri.c_str())); + fastestRequest->setUri(uri); fastestRequest->setReferer(base->getReferer()); + uris_.erase(std::find(uris_.begin(), uris_.end(), uri)); + spentUris_.push_back(uri); inFlightRequests_.push_back(fastestRequest); lastFasterReplace_ = global::wallclock; return fastestRequest;