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/shill_main.cc b/shill_main.cc
index df610ca..c3153a1 100644
--- a/shill_main.cc
+++ b/shill_main.cc
@@ -94,17 +94,20 @@
shill::Config config; /* (config_dir, default_config_dir) */
+ // TODO(pstew): This should be chosen based on config
+ scoped_ptr<shill::DBusControl> dbus_control(new shill::DBusControl());
+ dbus_control->Init();
+
shill::ProxyFactory proxy_factory;
+ proxy_factory.Init();
shill::ProxyFactory::set_factory(&proxy_factory);
- // TODO(pstew): This should be chosen based on config
- shill::DBusControl *dbus_control = new shill::DBusControl();
- dbus_control->Init();
shill::GLib glib;
glib.TypeInit();
- shill::DHCPProvider::GetInstance()->Init(dbus_control->connection(), &glib);
- shill::Daemon daemon(&config, dbus_control, &glib);
+ shill::DHCPProvider::GetInstance()->Init(&glib);
+
+ shill::Daemon daemon(&config, dbus_control.get(), &glib);
daemon.Run();
return 0;