Skip to content

Commit

Permalink
Allow access to connection in object server
Browse files Browse the repository at this point in the history
Allow connection object to be accessed out of the dbus_interface. See
#83 for reference.

Similar pattern to asio's get_executor() method exposed on sockets.

Can reduce parameter count when working in code where the dbus_interface
is passed around. When components register their own interface onto
a preexisting dbus_interface but require access to the connection
or the connections underlying execution context.

Change-Id: Ie9df1f2762f639de60b492255d6f9d85920b0fd6
Signed-off-by: Ómar Högni Guðmarsson <[email protected]>
  • Loading branch information
omsigum authored and Ómar Högni Guðmarsson committed Feb 28, 2024
1 parent e12a23c commit 9742b53
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/sdbusplus/asio/object_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ class dbus_interface
std::vector<std::string>{name_});
}

auto connection() const noexcept
-> std::shared_ptr<sdbusplus::asio::connection>
{
return conn_;
}

template <typename PropertyType, typename CallbackTypeGet>
bool register_property_r(const std::string& name,
const PropertyType& property,
Expand Down

0 comments on commit 9742b53

Please sign in to comment.