shill: Don't create DHCP and Modem D-Bus proxies in signal callbacks.
dbus-c++ doesn't allow proxy creation in signal callbacks so create them in
deferred tasks instead.
BUG=chromium-os:18228
TEST=unit tests, tested on device
Change-Id: I4f85ab937aef99ef4556c5a3c16af913d8fa08fd
Reviewed-on: http://gerrit.chromium.org/gerrit/4827
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
diff --git a/dhcpcd_proxy.cc b/dhcpcd_proxy.cc
index d77efb1..f1483e8 100644
--- a/dhcpcd_proxy.cc
+++ b/dhcpcd_proxy.cc
@@ -69,7 +69,7 @@
config->InitProxy(signal.sender());
}
-DHCPCDProxy::DHCPCDProxy(DBus::Connection *connection, const char *service)
+DHCPCDProxy::DHCPCDProxy(DBus::Connection *connection, const string &service)
: proxy_(connection, service) {
VLOG(2) << "DHCPCDProxy(service=" << service << ").";
}
@@ -83,14 +83,16 @@
}
DHCPCDProxy::Proxy::Proxy(DBus::Connection *connection,
- const char *service)
- : DBus::ObjectProxy(*connection, kDBusPath, service) {
+ const string &service)
+ : DBus::ObjectProxy(*connection, kDBusPath, service.c_str()) {
// Don't catch signals directly in this proxy because they will be dispatched
// to the client by the DHCPCD listener.
_signals.erase("Event");
_signals.erase("StatusChanged");
}
+DHCPCDProxy::Proxy::~Proxy() {}
+
void DHCPCDProxy::Proxy::Event(const uint32_t &pid,
const std::string &reason,
const DHCPConfig::Configuration &configuration) {