Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: multi_http_fetcher.h

Issue 3620013: AU: Resume interrupted update attempts. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: fix setup download Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « generate_delta_main.cc ('k') | omaha_response_handler_action.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: multi_http_fetcher.h
diff --git a/multi_http_fetcher.h b/multi_http_fetcher.h
index cee7de03bf8d4bb138a384f1eaf46b7f4b7772bd..197234799e1d3d4259ec9f55eab76c29416f952e 100644
--- a/multi_http_fetcher.h
+++ b/multi_http_fetcher.h
@@ -40,7 +40,7 @@ class MultiHttpFetcher : public HttpFetcher, public HttpFetcherDelegate {
(*it)->set_delegate(this);
}
}
-
+
void SetOffset(off_t offset) {} // for now, doesn't support this
// Begins the transfer to the specified URL.
@@ -100,17 +100,18 @@ class MultiHttpFetcher : public HttpFetcher, public HttpFetcherDelegate {
if (delegate_)
delegate_->TransferComplete(this, successful);
}
-
+
void StartTransfer() {
if (current_index_ >= ranges_.size()) {
return;
}
- LOG(INFO) << "Starting a transfer";
+ LOG(INFO) << "Starting a transfer @" << ranges_[current_index_].first << "("
+ << ranges_[current_index_].second << ")";
bytes_received_this_fetcher_ = 0;
fetchers_[current_index_]->SetOffset(ranges_[current_index_].first);
fetchers_[current_index_]->BeginTransfer(url_);
}
-
+
void ReceivedBytes(HttpFetcher* fetcher,
const char* bytes,
int length) {
@@ -148,7 +149,7 @@ class MultiHttpFetcher : public HttpFetcher, public HttpFetcherDelegate {
SendTransferComplete(fetcher, true);
return;
}
-
+
if (ranges_[current_index_].second < 0) {
// We're done with the current operation
current_index_++;
@@ -160,7 +161,7 @@ class MultiHttpFetcher : public HttpFetcher, public HttpFetcherDelegate {
}
return;
}
-
+
if (bytes_received_this_fetcher_ < ranges_[current_index_].second) {
LOG(WARNING) << "Received insufficient bytes from fetcher. "
<< "Ending early";
@@ -170,13 +171,13 @@ class MultiHttpFetcher : public HttpFetcher, public HttpFetcherDelegate {
LOG(INFO) << "Got spurious TransferComplete. Ingoring.";
}
}
-
+
// If true, do not send any more data or TransferComplete to the delegate.
bool sent_transfer_complete_;
-
+
RangesVect ranges_;
std::vector<std::tr1::shared_ptr<BaseHttpFetcher> > fetchers_;
-
+
RangesVect::size_type current_index_; // index into ranges_, fetchers_
off_t bytes_received_this_fetcher_;
« no previous file with comments | « generate_delta_main.cc ('k') | omaha_response_handler_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698