shill: Convert DHCP Proxy to use a model similar to Supplicant and ModemManager.
Also, don't create a DBus connection for each proxy since this doesn't work in
some event callbacks and wastes resources. Instead use a shared connection
provided by the ProxyFactory.
BUG=chromium-os:17735
TEST=unit tests, tested on device
Change-Id: I4d16b430783c1159501c0414ef3b846bce1a4c0e
Reviewed-on: http://gerrit.chromium.org/gerrit/4279
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
diff --git a/dhcp_config.cc b/dhcp_config.cc
index 5a4a307..f395380 100644
--- a/dhcp_config.cc
+++ b/dhcp_config.cc
@@ -15,6 +15,7 @@
#include "shill/dhcp_provider.h"
#include "shill/glib.h"
#include "shill/ip_address.h"
+#include "shill/proxy_factory.h"
using std::string;
using std::vector;
@@ -84,7 +85,7 @@
LOG(ERROR) << "Unable to renew IP before acquiring destination.";
return false;
}
- proxy_->DoRebind(device_name());
+ proxy_->Rebind(device_name());
return true;
}
@@ -97,14 +98,14 @@
LOG(ERROR) << "Unable to release IP before acquiring destination.";
return false;
}
- proxy_->DoRelease(device_name());
+ proxy_->Release(device_name());
Stop();
return true;
}
-void DHCPConfig::InitProxy(DBus::Connection *connection, const char *service) {
+void DHCPConfig::InitProxy(const char *service) {
if (!proxy_.get()) {
- proxy_.reset(new DHCPCDProxy(connection, service));
+ proxy_.reset(ProxyFactory::factory()->CreateDHCPProxy(service));
}
}