| 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/update_attempter.h" | 5 #include "update_engine/update_attempter.h" |
| 6 | 6 |
| 7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L | 7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L |
| 8 #ifndef _POSIX_C_SOURCE | 8 #ifndef _POSIX_C_SOURCE |
| 9 #define _POSIX_C_SOURCE 199309L | 9 #define _POSIX_C_SOURCE 199309L |
| 10 #endif // _POSIX_C_SOURCE | 10 #endif // _POSIX_C_SOURCE |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 449 } |
| 450 | 450 |
| 451 void UpdateAttempter::CreatePendingErrorEvent(AbstractAction* action, | 451 void UpdateAttempter::CreatePendingErrorEvent(AbstractAction* action, |
| 452 ActionExitCode code) { | 452 ActionExitCode code) { |
| 453 if (error_event_.get()) { | 453 if (error_event_.get()) { |
| 454 // This shouldn't really happen. | 454 // This shouldn't really happen. |
| 455 LOG(WARNING) << "There's already an existing pending error event."; | 455 LOG(WARNING) << "There's already an existing pending error event."; |
| 456 return; | 456 return; |
| 457 } | 457 } |
| 458 | 458 |
| 459 // For now assume that Omaha response action failure means that | 459 // For now assume that a generic Omaha response action failure means that |
| 460 // there's no update so don't send an event. Also, double check that | 460 // there's no update so don't send an event. Also, double check that the |
| 461 // the failure has not occurred while sending an error event -- in | 461 // failure has not occurred while sending an error event -- in which case |
| 462 // which case don't schedule another. This shouldn't really happen | 462 // don't schedule another. This shouldn't really happen but just in case... |
| 463 // but just in case... | 463 if ((action->Type() == OmahaResponseHandlerAction::StaticType() && |
| 464 if (action->Type() == OmahaResponseHandlerAction::StaticType() || | 464 code == kActionCodeError) || |
| 465 status_ == UPDATE_STATUS_REPORTING_ERROR_EVENT) { | 465 status_ == UPDATE_STATUS_REPORTING_ERROR_EVENT) { |
| 466 return; | 466 return; |
| 467 } | 467 } |
| 468 | 468 |
| 469 code = GetErrorCodeForAction(action, code); | 469 code = GetErrorCodeForAction(action, code); |
| 470 error_event_.reset(new OmahaEvent(OmahaEvent::kTypeUpdateComplete, | 470 error_event_.reset(new OmahaEvent(OmahaEvent::kTypeUpdateComplete, |
| 471 OmahaEvent::kResultError, | 471 OmahaEvent::kResultError, |
| 472 code)); | 472 code)); |
| 473 } | 473 } |
| 474 | 474 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 uint64_t resume_offset = manifest_metadata_size + next_data_offset; | 571 uint64_t resume_offset = manifest_metadata_size + next_data_offset; |
| 572 if (resume_offset < response_handler_action_->install_plan().size) { | 572 if (resume_offset < response_handler_action_->install_plan().size) { |
| 573 fetcher->AddRange(resume_offset, -1); | 573 fetcher->AddRange(resume_offset, -1); |
| 574 } | 574 } |
| 575 } else { | 575 } else { |
| 576 fetcher->AddRange(0, -1); | 576 fetcher->AddRange(0, -1); |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 | 579 |
| 580 } // namespace chromeos_update_engine | 580 } // namespace chromeos_update_engine |
| OLD | NEW |