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 "src/service.h" | 5 #include "src/service.h" |
6 | 6 |
7 #include <glog/logging.h> | 7 #include <glog/logging.h> |
8 | 8 |
9 #include "src/data_plan_provider.h" | 9 #include "src/data_plan_provider.h" |
10 #include "src/device.h" | 10 #include "src/device.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 device_->GetCarrier().compare(Device::kCarrierUnknown)); | 489 device_->GetCarrier().compare(Device::kCarrierUnknown)); |
490 | 490 |
491 if (request_in_progress_) { | 491 if (request_in_progress_) { |
492 return; | 492 return; |
493 } | 493 } |
494 | 494 |
495 // TODO(vlaviano): apply policy to determine if current connectivity state | 495 // TODO(vlaviano): apply policy to determine if current connectivity state |
496 // allows this request (e.g., if we can only make API requests over the | 496 // allows this request (e.g., if we can only make API requests over the |
497 // cellular service itself, is this service the default route?) | 497 // cellular service itself, is this service the default route?) |
498 | 498 |
| 499 request_in_progress_ = true; |
499 if (!provider_->RequestUsageUpdate()) { | 500 if (!provider_->RequestUsageUpdate()) { |
500 DLOG(WARNING) << path_ << ": RequestUsageUpdate: request failed"; | 501 DLOG(WARNING) << path_ << ": RequestUsageUpdate: request failed"; |
| 502 request_in_progress_ = false; |
501 } else { | 503 } else { |
502 DLOG(INFO) << path_ << ": RequestUsageUpdate: request succeeded"; | 504 DLOG(INFO) << path_ << ": RequestUsageUpdate: request succeeded"; |
503 request_in_progress_ = true; | |
504 } | 505 } |
505 } | 506 } |
506 | 507 |
507 void Service::CancelPendingRequests() { | 508 void Service::CancelPendingRequests() { |
508 if (provider_ != NULL && request_in_progress_) { | 509 if (provider_ != NULL && request_in_progress_) { |
509 provider_->CancelPendingRequests(); | 510 provider_->CancelPendingRequests(); |
510 request_in_progress_ = false; | 511 request_in_progress_ = false; |
511 } | 512 } |
512 } | 513 } |
513 | 514 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 DestroyUpdateTimer(); | 563 DestroyUpdateTimer(); |
563 CancelPendingRequests(); | 564 CancelPendingRequests(); |
564 if (provider_ != NULL) { | 565 if (provider_ != NULL) { |
565 DLOG(INFO) << path_ << ": DeleteCarrierState: deleting data plan provider"; | 566 DLOG(INFO) << path_ << ": DeleteCarrierState: deleting data plan provider"; |
566 delete provider_; | 567 delete provider_; |
567 provider_ = NULL; | 568 provider_ = NULL; |
568 } | 569 } |
569 } | 570 } |
570 | 571 |
571 } // namespace cashew | 572 } // namespace cashew |
OLD | NEW |