Skip to content

Commit

Permalink
sdbusplus: Provide option to skip signal property
Browse files Browse the repository at this point in the history
InterfacesAdded signal itself will send out all propety
details and it's values during start-up of a D-Bus daemon service.
Sending properties changed signal confuses the signal handler
as it can't differentiate between service restart or real
property change event. Exposing a way to skip sending
properties changed signal during initialize (to avoid
breaking any old one).

Tested-by:
1. Verified that when initialize(true) is called, properties
changed signal are not sent out from D-Bus daemon
2. Still old method works fine.

Change-Id: Ib436ea9313b08623d931c58b11a770081511ab72
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
  • Loading branch information
Richard Marian Thomaiyar committed Mar 19, 2019
1 parent ebdc371 commit 1ecde80
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sdbusplus/asio/object_server.hpp
Expand Up @@ -674,7 +674,7 @@ class dbus_interface
return sd_bus_error_set_const(error, SD_BUS_ERROR_INVALID_ARGS, NULL);
}

bool initialize()
bool initialize(const bool skipPropertyChangedSignal = false)
{
// can only register once
if (initialized_)
Expand All @@ -690,9 +690,12 @@ class dbus_interface
this);
conn_->emit_interfaces_added(path_.c_str(),
std::vector<std::string>{name_});
for (const std::string& name : propertyNames_)
if (!skipPropertyChangedSignal)
{
signal_property(name);
for (const std::string& name : propertyNames_)
{
signal_property(name);
}
}
return true;
}
Expand Down

0 comments on commit 1ecde80

Please sign in to comment.