Persist dbus_control DBus Connection object
In real life creating (and destroying by dropping out of scope)
DBus Connection objects leaves DBus Adaptor objects pointing at
invalid connection object references. Instead, persist a single
connection object using a scoped pointer and use this for all
objects.
Another observed side-effect is that creating a real device
in device_dbus_adaptor.cc yields a "DBus::ErrorNoMemeory" if
only kPath is used in device_dbus_adaptor.cc. Although this
isn't a complete solution, this CL also adds a call to a
function "deviice->Name()" to add a unique path component.
BUG=chromium-os:15837
TEST=Run unit tests, run on real device and do ethernet plug/unplug
Change-Id: Icbfb3d8b845346c063a301217e562f3feee02c1b
Reviewed-on: http://gerrit.chromium.org/gerrit/1828
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/device_dbus_adaptor.cc b/device_dbus_adaptor.cc
index fe19eba..2626023 100644
--- a/device_dbus_adaptor.cc
+++ b/device_dbus_adaptor.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "shill/device.h"
#include "shill/device_dbus_adaptor.h"
#include <map>
@@ -19,7 +20,7 @@
const char DeviceDBusAdaptor::kPath[] = SHILL_PATH "/Device";
DeviceDBusAdaptor::DeviceDBusAdaptor(DBus::Connection& conn, Device *device)
- : DBusAdaptor(conn, kPath),
+ : DBusAdaptor(conn, string(kPath) + string("/") + device->Name()),
device_(device) {
}
DeviceDBusAdaptor::~DeviceDBusAdaptor() {}