bus: add process_discard method for server operation
A server process will generally set up a number of sd-bus managed
objects and enter a while-loop. All further interactions are
expected to take place via the registered callbacks.
Provide an alternative 'process' method on the bus to indicate to
sd-bus that the process does not intend to handle any "escaping"
messages. This allows sd-bus to immediately error to the client
rather than the server discarding the message and the client timing
out.
Change-Id: I3bf793e9f3d4f8d330758ebd282bbf28350bf338
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/sdbusplus/bus.hpp b/sdbusplus/bus.hpp
index 20e0836..84f45ce 100644
--- a/sdbusplus/bus.hpp
+++ b/sdbusplus/bus.hpp
@@ -90,6 +90,13 @@
return message::message(m);
}
+ /** @brief Process waiting dbus messages or signals, discarding unhandled.
+ */
+ void process_discard()
+ {
+ sd_bus_process(_bus.get(), nullptr);
+ }
+
/** @brief Claim a service name on the dbus.
*
* @param[in] service - The service name to claim.