tree-wide: install matches asynchronously
Let's remove a number of synchronization points from our service startups: let's drop synchronous match installation, and let's opt for asynchronous instead. Also, let's use sd_bus_match_signal() instead of sd_bus_add_match() where we can.
This commit is contained in:
@@ -2905,7 +2905,6 @@ static int start_unit_one(
|
||||
|
||||
if (wait_context) {
|
||||
_cleanup_free_ char *unit_path = NULL;
|
||||
const char* mt;
|
||||
|
||||
log_debug("Watching for property changes of %s", name);
|
||||
r = sd_bus_call_method(
|
||||
@@ -2928,13 +2927,15 @@ static int start_unit_one(
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add unit path %s to set: %m", unit_path);
|
||||
|
||||
mt = strjoina("type='signal',"
|
||||
"interface='org.freedesktop.DBus.Properties',"
|
||||
"path='", unit_path, "',"
|
||||
"member='PropertiesChanged'");
|
||||
r = sd_bus_add_match(bus, &wait_context->match, mt, on_properties_changed, wait_context);
|
||||
r = sd_bus_match_signal_async(bus,
|
||||
&wait_context->match,
|
||||
NULL,
|
||||
unit_path,
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"PropertiesChanged",
|
||||
on_properties_changed, NULL, wait_context);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add match for PropertiesChanged signal: %m");
|
||||
return log_error_errno(r, "Failed to request match for PropertiesChanged signal: %m");
|
||||
}
|
||||
|
||||
log_debug("%s manager for %s on %s, %s",
|
||||
|
||||
Reference in New Issue
Block a user