boost version 1.86 support
Added fix for boost::asio::spawn overload issue reported similar
to chriskohlhoff/asio#1524, during boost 1.86 migration build.
Proposed fix is to use default completion token.
Tested: verified build
Change-Id: Ie3ebcf963f998fd6064e8efab49d1fe584d4b587
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index 125e89e..fbc0c98 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -346,9 +346,11 @@
});
// call once to populate
- boost::asio::spawn(*getIoContext(), [](boost::asio::yield_context yield) {
- replaceCacheFru(getSdBus(), yield);
- });
+ boost::asio::spawn(*getIoContext(),
+ [](boost::asio::yield_context yield) {
+ replaceCacheFru(getSdBus(), yield);
+ },
+ {});
}
/** @brief implements the read FRU data command
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index 1f3dfc1..1bb8934 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -764,41 +764,44 @@
{
// make a copy so the next two moves don't wreak havoc on the stack
sdbusplus::message_t b{m};
- boost::asio::spawn(*getIoContext(), [b = std::move(b)](
- boost::asio::yield_context yield) {
- sdbusplus::message_t m{std::move(b)};
- unsigned char seq = 0, netFn = 0, lun = 0, cmd = 0;
- ipmi::SecureBuffer data;
+ boost::asio::spawn(
+ *getIoContext(),
+ [b = std::move(b)](boost::asio::yield_context yield) {
+ sdbusplus::message_t m{std::move(b)};
+ unsigned char seq = 0, netFn = 0, lun = 0, cmd = 0;
+ ipmi::SecureBuffer data;
- m.read(seq, netFn, lun, cmd, data);
- std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
- auto ctx = std::make_shared<ipmi::Context>(
- bus, netFn, lun, cmd, 0, 0, 0, ipmi::Privilege::Admin, 0, 0, yield);
- auto request = std::make_shared<ipmi::message::Request>(
- ctx, std::forward<ipmi::SecureBuffer>(data));
- ipmi::message::Response::ptr response =
- ipmi::executeIpmiCommand(request);
+ m.read(seq, netFn, lun, cmd, data);
+ std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
+ auto ctx = std::make_shared<ipmi::Context>(
+ bus, netFn, lun, cmd, 0, 0, 0, ipmi::Privilege::Admin, 0, 0,
+ yield);
+ auto request = std::make_shared<ipmi::message::Request>(
+ ctx, std::forward<ipmi::SecureBuffer>(data));
+ ipmi::message::Response::ptr response =
+ ipmi::executeIpmiCommand(request);
- // Responses in IPMI require a bit set. So there ya go...
- netFn |= 0x01;
+ // Responses in IPMI require a bit set. So there ya go...
+ netFn |= 0x01;
- const char *dest, *path;
- constexpr const char* DBUS_INTF = "org.openbmc.HostIpmi";
+ const char *dest, *path;
+ constexpr const char* DBUS_INTF = "org.openbmc.HostIpmi";
- dest = m.get_sender();
- path = m.get_path();
- boost::system::error_code ec;
- bus->yield_method_call(yield, ec, dest, path, DBUS_INTF, "sendMessage",
- seq, netFn, lun, cmd, response->cc,
- response->payload.raw);
- if (ec)
- {
- lg2::error(
- "Failed to send response to requestor ({NETFN}/{CMD}): {ERROR}",
- "ERROR", ec.message(), "SENDER", dest, "NETFN", lg2::hex, netFn,
- "CMD", lg2::hex, cmd);
- }
- });
+ dest = m.get_sender();
+ path = m.get_path();
+ boost::system::error_code ec;
+ bus->yield_method_call(yield, ec, dest, path, DBUS_INTF,
+ "sendMessage", seq, netFn, lun, cmd,
+ response->cc, response->payload.raw);
+ if (ec)
+ {
+ lg2::error(
+ "Failed to send response to requestor ({NETFN}/{CMD}): {ERROR}",
+ "ERROR", ec.message(), "SENDER", dest, "NETFN", lg2::hex,
+ netFn, "CMD", lg2::hex, cmd);
+ }
+ },
+ {});
}
#endif /* ALLOW_DEPRECATED_API */