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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if (type == DownloadAction::StaticType()) { | 290 if (type == DownloadAction::StaticType()) { |
291 download_progress_ = 0.0; | 291 download_progress_ = 0.0; |
292 DownloadAction* download_action = dynamic_cast<DownloadAction*>(action); | 292 DownloadAction* download_action = dynamic_cast<DownloadAction*>(action); |
293 http_response_code_ = download_action->GetHTTPResponseCode(); | 293 http_response_code_ = download_action->GetHTTPResponseCode(); |
294 } else if (type == OmahaRequestAction::StaticType()) { | 294 } else if (type == OmahaRequestAction::StaticType()) { |
295 OmahaRequestAction* omaha_request_action = | 295 OmahaRequestAction* omaha_request_action = |
296 dynamic_cast<OmahaRequestAction*>(action); | 296 dynamic_cast<OmahaRequestAction*>(action); |
297 // If the request is not an event, then it's the update-check. | 297 // If the request is not an event, then it's the update-check. |
298 if (!omaha_request_action->IsEvent()) { | 298 if (!omaha_request_action->IsEvent()) { |
299 http_response_code_ = omaha_request_action->GetHTTPResponseCode(); | 299 http_response_code_ = omaha_request_action->GetHTTPResponseCode(); |
| 300 // Forward the server-dictated poll interval to the update check |
| 301 // scheduler, if any. |
| 302 if (update_check_scheduler_) { |
| 303 update_check_scheduler_->set_poll_interval( |
| 304 omaha_request_action->GetOutputObject().poll_interval); |
| 305 } |
300 } | 306 } |
301 } | 307 } |
302 if (code != kActionCodeSuccess) { | 308 if (code != kActionCodeSuccess) { |
303 // On failure, schedule an error event to be sent to Omaha. | 309 // On failure, schedule an error event to be sent to Omaha. |
304 CreatePendingErrorEvent(action, code); | 310 CreatePendingErrorEvent(action, code); |
305 return; | 311 return; |
306 } | 312 } |
307 // Find out which action completed. | 313 // Find out which action completed. |
308 if (type == OmahaResponseHandlerAction::StaticType()) { | 314 if (type == OmahaResponseHandlerAction::StaticType()) { |
309 // Note that the status will be updated to DOWNLOADING when some | 315 // Note that the status will be updated to DOWNLOADING when some |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 SetPriority(utils::kProcessPriorityNormal); | 483 SetPriority(utils::kProcessPriorityNormal); |
478 return true; | 484 return true; |
479 } | 485 } |
480 // Set the priority to high and let GLib destroy the timeout source. | 486 // Set the priority to high and let GLib destroy the timeout source. |
481 SetPriority(utils::kProcessPriorityHigh); | 487 SetPriority(utils::kProcessPriorityHigh); |
482 manage_priority_source_ = NULL; | 488 manage_priority_source_ = NULL; |
483 return false; | 489 return false; |
484 } | 490 } |
485 | 491 |
486 } // namespace chromeos_update_engine | 492 } // namespace chromeos_update_engine |
OLD | NEW |