asio: connection: fix clang-tidy warning
With clang-16, numerous users of asio::connection are failing
clang-tidy with something like:
```
/usr/local/include/boost/asio/detail/impl/io_uring_descriptor_service.ipp:109:3: error: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage,-warnings-as-errors]
io_uring_service_.register_io_object(impl.io_object_data_);
/usr/local/include/boost/asio/detail/impl/io_uring_descriptor_service.ipp:109:3: note: Called C++ object pointer is null
io_uring_service_.register_io_object(impl.io_object_data_);
```
I have looked through the Boost code and cannot figure out any path
where the object really is null and since we use this code everywhere
I highly suspect it is not. In any case, by using an alternative
constructor we seem to have appeased clang-tidy. Switch to the
socket constructor which takes an executor instead of a context.
Tested: Ran `ninja clang-tidy` in openbmc/estoraged with this change in
a subproject.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I58295b5515acc46b7879001ce3ae8145f00d9726
diff --git a/include/sdbusplus/asio/connection.hpp b/include/sdbusplus/asio/connection.hpp
index 084b484..8badc94 100644
--- a/include/sdbusplus/asio/connection.hpp
+++ b/include/sdbusplus/asio/connection.hpp
@@ -53,15 +53,14 @@
public:
// default to system bus
connection(boost::asio::io_context& io) :
- sdbusplus::bus_t(sdbusplus::bus::new_default()), io_(io), socket(io_)
+ sdbusplus::bus_t(sdbusplus::bus::new_default()), io_(io),
+ socket(io_.get_executor(), get_fd())
{
- socket.assign(get_fd());
read_wait();
}
connection(boost::asio::io_context& io, sd_bus* bus) :
- sdbusplus::bus_t(bus), io_(io), socket(io_)
+ sdbusplus::bus_t(bus), io_(io), socket(io_.get_executor(), get_fd())
{
- socket.assign(get_fd());
read_wait();
}
~connection()