Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Unified Diff: src/service.cc

Issue 5321001: cashew: don't propagate inactive plans to clients (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/service.h ('K') | « src/service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/service.cc
diff --git a/src/service.cc b/src/service.cc
index 4b670702b5c914cf3ffa1621940af4f73ea4d067..797189b63aacdc4e2210b3487e2057f1aa673518 100644
--- a/src/service.cc
+++ b/src/service.cc
@@ -150,7 +150,13 @@ DBusDataPlanList Service::GetDBusDataPlans() const {
for (it = data_plans_.begin(); it != data_plans_.end(); ++it) {
DataPlan *plan = *it;
DCHECK(plan != NULL);
- dbus_data_plans.push_back(plan->ToDBusFormat());
+ // filter out inactive plans
+ if (plan->IsActive()) {
+ dbus_data_plans.push_back(plan->ToDBusFormat());
+ } else {
+ DLOG(INFO) << path_ << ": GetBusDataPlans: skipping inactive plan: \""
+ << plan->GetName() << "\"";
+ }
}
return dbus_data_plans;
}
@@ -262,8 +268,9 @@ void Service::OnByteCounterUpdate(uint64 rx_bytes, uint64 tx_bytes) {
active_plan->SetLocalBytesUsed(local_bytes_used);
DLOG(INFO) << path_
<< ": OnByteCounterUpdate: updated plan state: data bytes used = "
- << active_plan->GetDataBytesUsed() << ", local byes used = "
- << active_plan->GetLocalBytesUsed();
+ << active_plan->GetDataBytesUsed() << ", local bytes used = "
+ << active_plan->GetLocalBytesUsed() << ", total bytes used = "
+ << active_plan->GetTotalBytesUsed();
MaybeEmitDataPlansUpdate();
}
« src/service.h ('K') | « src/service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698