| 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/download_action.h" | 5 #include "update_engine/download_action.h" |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <glib.h> | 10 #include <glib.h> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 LOG_IF(WARNING, writer_->Close() != 0) << "Error closing the writer."; | 154 LOG_IF(WARNING, writer_->Close() != 0) << "Error closing the writer."; |
| 155 writer_ = NULL; | 155 writer_ = NULL; |
| 156 } | 156 } |
| 157 if (delegate_) { | 157 if (delegate_) { |
| 158 delegate_->SetDownloadStatus(false); // Set to inactive. | 158 delegate_->SetDownloadStatus(false); // Set to inactive. |
| 159 } | 159 } |
| 160 ActionExitCode code = | 160 ActionExitCode code = |
| 161 successful ? kActionCodeSuccess : kActionCodeDownloadTransferError; | 161 successful ? kActionCodeSuccess : kActionCodeDownloadTransferError; |
| 162 if (code == kActionCodeSuccess) { | 162 if (code == kActionCodeSuccess) { |
| 163 if (!install_plan_.is_full_update) { | 163 if (!install_plan_.is_full_update) { |
| 164 bool public_key_verify_failed = false; // TODO(adlr): don't ignore this. |
| 164 if (!delta_performer_->VerifyPayload("", | 165 if (!delta_performer_->VerifyPayload("", |
| 165 install_plan_.download_hash, | 166 install_plan_.download_hash, |
| 166 install_plan_.size)) { | 167 install_plan_.size, |
| 168 &public_key_verify_failed)) { |
| 167 LOG(ERROR) << "Download of " << install_plan_.download_url | 169 LOG(ERROR) << "Download of " << install_plan_.download_url |
| 168 << " failed due to payload verification error."; | 170 << " failed due to payload verification error."; |
| 169 code = kActionCodeDownloadPayloadVerificationError; | 171 code = kActionCodeDownloadPayloadVerificationError; |
| 170 } else if (!delta_performer_->GetNewPartitionInfo( | 172 } else if (!delta_performer_->GetNewPartitionInfo( |
| 171 &install_plan_.kernel_size, | 173 &install_plan_.kernel_size, |
| 172 &install_plan_.kernel_hash, | 174 &install_plan_.kernel_hash, |
| 173 &install_plan_.rootfs_size, | 175 &install_plan_.rootfs_size, |
| 174 &install_plan_.rootfs_hash)) { | 176 &install_plan_.rootfs_hash)) { |
| 175 LOG(ERROR) << "Unable to get new partition hash info."; | 177 LOG(ERROR) << "Unable to get new partition hash info."; |
| 176 code = kActionCodeDownloadNewPartitionInfoError; | 178 code = kActionCodeDownloadNewPartitionInfoError; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 200 processor_->ActionComplete(this, code); | 202 processor_->ActionComplete(this, code); |
| 201 } | 203 } |
| 202 | 204 |
| 203 void DownloadAction::TransferTerminated(HttpFetcher *fetcher) { | 205 void DownloadAction::TransferTerminated(HttpFetcher *fetcher) { |
| 204 if (code_ != kActionCodeSuccess) { | 206 if (code_ != kActionCodeSuccess) { |
| 205 processor_->ActionComplete(this, code_); | 207 processor_->ActionComplete(this, code_); |
| 206 } | 208 } |
| 207 } | 209 } |
| 208 | 210 |
| 209 }; // namespace {} | 211 }; // namespace {} |
| OLD | NEW |