sd-bus: add new sd_bus_is_ready() API
This new call is much light sd_bus_is_open(), but returns true only if the connection is fully set up, i.e. after we finished with the authentication and Hello() phase. This API is useful for clients in particular when using the "watch_bind" feature, as that way it can be determined in advance whether it makes sense to sync on some operation.
This commit is contained in:
@@ -540,4 +540,5 @@ global:
|
||||
sd_bus_add_match_async;
|
||||
sd_bus_match_signal;
|
||||
sd_bus_match_signal_async;
|
||||
sd_bus_is_ready;
|
||||
} LIBSYSTEMD_236;
|
||||
|
||||
@@ -1396,6 +1396,13 @@ _public_ int sd_bus_is_open(sd_bus *bus) {
|
||||
return BUS_IS_OPEN(bus->state);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_is_ready(sd_bus *bus) {
|
||||
assert_return(bus, -EINVAL);
|
||||
assert_return(!bus_pid_changed(bus), -ECHILD);
|
||||
|
||||
return bus->state == BUS_RUNNING;
|
||||
}
|
||||
|
||||
_public_ int sd_bus_can_send(sd_bus *bus, char type) {
|
||||
int r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user