shill: improve logging, and comment out unused args
1) Add some more context for a few logging calls.
2) Comment out some unused args, to make it obvious that they're
unused.
BUG=None
TEST=unit tests
Change-Id: I0a71a8d2311a17859f96793a88f950c3636cd91e
Reviewed-on: https://gerrit.chromium.org/gerrit/61601
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/cellular.cc b/cellular.cc
index 678f75b..7f29c19 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -474,6 +474,7 @@
}
void Cellular::DestroyService() {
+ SLOG(Cellular, 2) << __func__;
DropConnection();
if (service_) {
LOG(INFO) << "Deregistering cellular service " << service_->unique_name()
diff --git a/device.cc b/device.cc
index 04c5bc1..91bb897 100644
--- a/device.cc
+++ b/device.cc
@@ -543,11 +543,13 @@
}
void Device::DestroyConnection() {
- SLOG(Device, 2) << __func__;
+ SLOG(Device, 2) << __func__ << " on " << link_name_;
StopPortalDetection();
StopLinkMonitor();
StopTrafficMonitor();
if (selected_service_.get()) {
+ SLOG(Device, 3) << "Clearing connection of service "
+ << selected_service_->unique_name();
selected_service_->SetConnection(NULL);
}
connection_ = NULL;
@@ -556,7 +558,8 @@
void Device::SelectService(const ServiceRefPtr &service) {
SLOG(Device, 2) << __func__ << ": service "
- << (service ? service->unique_name() : "*reset*");
+ << (service ? service->unique_name() : "*reset*")
+ << " on " << link_name_;
if (selected_service_.get() == service.get()) {
// No change to |selected_service_|. Return early to avoid
diff --git a/device_info.cc b/device_info.cc
index af749f6..d21a0e0 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -540,7 +540,8 @@
<< infos_[dev_index].mac_address.HexEncode();
} else if (technology != Technology::kTunnel &&
technology != Technology::kPPP) {
- LOG(ERROR) << "Add Link message does not have IFLA_ADDRESS!";
+ LOG(ERROR) << "Add Link message for link '" << link_name
+ << "' does not have IFLA_ADDRESS!";
return;
}
metrics_->RegisterDevice(dev_index, technology);
diff --git a/ethernet.cc b/ethernet.cc
index 38786d2..3fa2ded 100644
--- a/ethernet.cc
+++ b/ethernet.cc
@@ -78,7 +78,7 @@
}
void Ethernet::Start(Error *error,
- const EnabledStateChangedCallback &callback) {
+ const EnabledStateChangedCallback &/*callback*/) {
service_ = new EthernetService(control_interface(),
dispatcher(),
metrics(),
@@ -90,7 +90,8 @@
error->Reset(); // indicate immediate completion
}
-void Ethernet::Stop(Error *error, const EnabledStateChangedCallback &callback) {
+void Ethernet::Stop(Error *error,
+ const EnabledStateChangedCallback &/*callback*/) {
if (service_) {
manager()->DeregisterService(service_);
service_ = NULL;
diff --git a/manager.cc b/manager.cc
index 5d632a6..23f46a9 100644
--- a/manager.cc
+++ b/manager.cc
@@ -957,10 +957,11 @@
}
void Manager::DeregisterService(const ServiceRefPtr &to_forget) {
- vector<ServiceRefPtr>::iterator it;
- for (it = services_.begin(); it != services_.end(); ++it) {
+ for (auto it = services_.begin(); it != services_.end(); ++it) {
if (to_forget->unique_name() == (*it)->unique_name()) {
- DCHECK(!(*it)->connection());
+ DLOG_IF(FATAL, (*it)->connection())
+ << "Service " << (*it)->unique_name()
+ << " still has a connection (in call to " << __func__ << ")";
(*it)->Unload();
(*it)->SetProfile(NULL);
services_.erase(it);
diff --git a/virtual_device.cc b/virtual_device.cc
index 72d56a3..3c1e178 100644
--- a/virtual_device.cc
+++ b/virtual_device.cc
@@ -41,7 +41,7 @@
}
void VirtualDevice::Start(Error *error,
- const EnabledStateChangedCallback &callback) {
+ const EnabledStateChangedCallback &/*callback*/) {
RTNLHandler::GetInstance()->SetInterfaceFlags(interface_index(), IFF_UP,
IFF_UP);
if (error)
@@ -49,7 +49,7 @@
}
void VirtualDevice::Stop(Error *error,
- const EnabledStateChangedCallback &callback) {
+ const EnabledStateChangedCallback &/*callback*/) {
if (error)
error->Reset();
}
diff --git a/wifi.cc b/wifi.cc
index 83e1a0d..83a3833 100644
--- a/wifi.cc
+++ b/wifi.cc
@@ -224,7 +224,8 @@
file_reader.Close();
}
-void WiFi::Start(Error *error, const EnabledStateChangedCallback &callback) {
+void WiFi::Start(Error *error,
+ const EnabledStateChangedCallback &/*callback*/) {
SLOG(WiFi, 2) << "WiFi " << link_name() << " starting.";
if (enabled()) {
return;
@@ -259,7 +260,7 @@
ConnectToSupplicant();
}
-void WiFi::Stop(Error *error, const EnabledStateChangedCallback &callback) {
+void WiFi::Stop(Error *error, const EnabledStateChangedCallback &/*callback*/) {
SLOG(WiFi, 2) << "WiFi " << link_name() << " stopping.";
DropConnection();
StopScanTimer();