| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (omaha_hash_calculator_.hash() != install_plan_.download_hash) { | 143 if (omaha_hash_calculator_.hash() != install_plan_.download_hash) { |
| 144 LOG(ERROR) << "Download of " << install_plan_.download_url | 144 LOG(ERROR) << "Download of " << install_plan_.download_url |
| 145 << " failed. Expected hash " << install_plan_.download_hash | 145 << " failed. Expected hash " << install_plan_.download_hash |
| 146 << " but got hash " << omaha_hash_calculator_.hash(); | 146 << " but got hash " << omaha_hash_calculator_.hash(); |
| 147 code = kActionCodeDownloadHashMismatchError; | 147 code = kActionCodeDownloadHashMismatchError; |
| 148 } else if (bytes_received_ != install_plan_.size) { | 148 } else if (bytes_received_ != install_plan_.size) { |
| 149 LOG(ERROR) << "Download of " << install_plan_.download_url | 149 LOG(ERROR) << "Download of " << install_plan_.download_url |
| 150 << " failed. Expected size " << install_plan_.size | 150 << " failed. Expected size " << install_plan_.size |
| 151 << " but got size " << bytes_received_; | 151 << " but got size " << bytes_received_; |
| 152 code = kActionCodeDownloadSizeMismatchError; | 152 code = kActionCodeDownloadSizeMismatchError; |
| 153 } else if (!install_plan_.is_full_update && |
| 154 !delta_performer_->VerifyPayload("")) { |
| 155 LOG(ERROR) << "Download of " << install_plan_.download_url |
| 156 << " failed due to payload verification error."; |
| 157 code = kActionCodeDownloadPayloadVerificationError; |
| 153 } | 158 } |
| 154 } | 159 } |
| 155 | 160 |
| 156 FlushLinuxCaches(); | 161 FlushLinuxCaches(); |
| 157 | 162 |
| 158 // Write the path to the output pipe if we're successful. | 163 // Write the path to the output pipe if we're successful. |
| 159 if (code == kActionCodeSuccess && HasOutputPipe()) | 164 if (code == kActionCodeSuccess && HasOutputPipe()) |
| 160 SetOutputObject(GetInputObject()); | 165 SetOutputObject(GetInputObject()); |
| 161 processor_->ActionComplete(this, code); | 166 processor_->ActionComplete(this, code); |
| 162 } | 167 } |
| 163 | 168 |
| 164 }; // namespace {} | 169 }; // namespace {} |
| OLD | NEW |