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

Side by Side Diff: multi_range_http_fetcher.cc

Issue 6693047: AU: HttpFetcher: Fix segfault with multi fetcher and small transfers (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « http_fetcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/multi_range_http_fetcher.h" 5 #include "update_engine/multi_range_http_fetcher.h"
6 6
7 #include "update_engine/utils.h" 7 #include "update_engine/utils.h"
8 8
9 namespace chromeos_update_engine { 9 namespace chromeos_update_engine {
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 Reset(); 116 Reset();
117 // Note that after the callback returns this object may be destroyed. 117 // Note that after the callback returns this object may be destroyed.
118 if (delegate_) 118 if (delegate_)
119 delegate_->TransferComplete(this, false); 119 delegate_->TransferComplete(this, false);
120 return; 120 return;
121 } 121 }
122 // We got enough bytes and there were bytes specified, so this is success. 122 // We got enough bytes and there were bytes specified, so this is success.
123 successful = true; 123 successful = true;
124 } 124 }
125 125
126 // If we have another fetcher, use that. 126 // If we have another transfer, do that.
127 if (current_index_ + 1 < ranges_.size()) { 127 if (current_index_ + 1 < ranges_.size()) {
128 current_index_++; 128 current_index_++;
129 LOG(INFO) << "Starting next transfer (" << current_index_ << ")."; 129 LOG(INFO) << "Starting next transfer (" << current_index_ << ").";
130 StartTransfer(); 130 StartTransfer();
131 return; 131 return;
132 } 132 }
133 133
134 LOG(INFO) << "Done w/ all transfers"; 134 LOG(INFO) << "Done w/ all transfers";
135 Reset(); 135 Reset();
136 // Note that after the callback returns this object may be destroyed. 136 // Note that after the callback returns this object may be destroyed.
(...skipping 12 matching lines...) Expand all
149 TransferEnded(fetcher, false); 149 TransferEnded(fetcher, false);
150 } 150 }
151 151
152 void MultiRangeHTTPFetcher::Reset() { 152 void MultiRangeHTTPFetcher::Reset() {
153 base_fetcher_active_ = pending_transfer_ended_ = terminating_ = false; 153 base_fetcher_active_ = pending_transfer_ended_ = terminating_ = false;
154 current_index_ = 0; 154 current_index_ = 0;
155 bytes_received_this_range_ = 0; 155 bytes_received_this_range_ = 0;
156 } 156 }
157 157
158 } // namespace chromeos_update_engine 158 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « http_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698