OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |