pw-reserve: use arg0namespace for dbus match rule

Only names in the `org.freedesktop.ReserveDevice1` namespace
are interesting for the purposes of device reservation, so
use `arg0namespace` in the dbus match rule to filter out others.
This commit is contained in:
Barnabás Pőcze 2024-01-07 17:27:41 +01:00 committed by Wim Taymans
parent a154169942
commit 72d5417857

View file

@ -11,7 +11,7 @@
#include <spa/utils/string.h> #include <spa/utils/string.h>
#include <pipewire/log.h> #include <pipewire/log.h>
#define SERVICE_PREFIX "org.freedesktop.ReserveDevice1." #define SERVICE_NAMESPACE "org.freedesktop.ReserveDevice1"
#define OBJECT_PREFIX "/org/freedesktop/ReserveDevice1/" #define OBJECT_PREFIX "/org/freedesktop/ReserveDevice1/"
static const char introspection[] = static const char introspection[] =
@ -363,7 +363,7 @@ rd_device_new(DBusConnection *connection, const char *device_name, const char *a
res = -errno; res = -errno;
goto error_free; goto error_free;
} }
d->service_name = spa_aprintf(SERVICE_PREFIX "%s", device_name); d->service_name = spa_aprintf(SERVICE_NAMESPACE ".%s", device_name);
if (d->service_name == NULL) { if (d->service_name == NULL) {
res = -errno; res = -errno;
goto error_free; goto error_free;
@ -384,7 +384,7 @@ rd_device_new(DBusConnection *connection, const char *device_name, const char *a
"interface='org.freedesktop.DBus',member='NameAcquired'", NULL); "interface='org.freedesktop.DBus',member='NameAcquired'", NULL);
dbus_bus_add_match(d->connection, dbus_bus_add_match(d->connection,
"type='signal',sender='org.freedesktop.DBus'," "type='signal',sender='org.freedesktop.DBus',"
"interface='org.freedesktop.DBus',member='NameOwnerChanged'", NULL); "interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0namespace='" SERVICE_NAMESPACE "'", NULL);
dbus_connection_ref(d->connection); dbus_connection_ref(d->connection);