mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
client: send an error to all bound resources
When we need to send an error to a global, send the error to all resources bound to that global. This can also be resources that implement the global (like client-node)
This commit is contained in:
parent
d3ab5bc3b8
commit
f353042460
1 changed files with 18 additions and 11 deletions
|
|
@ -105,23 +105,30 @@ client_permission_func(struct pw_global *global,
|
||||||
return p->permissions;
|
return p->permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct error_data {
|
||||||
|
uint32_t id;
|
||||||
|
int res;
|
||||||
|
const char *error;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int error_resource(void *object, void *data)
|
||||||
|
{
|
||||||
|
struct pw_resource *r = object;
|
||||||
|
struct error_data *d = data;
|
||||||
|
if (r && r->bound_id == d->id)
|
||||||
|
pw_resource_error(r, d->res, d->error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int client_error(void *object, uint32_t id, int res, const char *error)
|
static int client_error(void *object, uint32_t id, int res, const char *error)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct resource_data *data = pw_resource_get_user_data(resource);
|
struct resource_data *data = pw_resource_get_user_data(resource);
|
||||||
struct pw_impl_client *client = data->client;
|
struct pw_impl_client *client = data->client;
|
||||||
struct pw_global *global;
|
struct error_data d = { id, res, error };
|
||||||
struct pw_resource *r, *t;
|
|
||||||
|
|
||||||
global = pw_context_find_global(client->context, id);
|
pw_log_debug(NAME" %p: error for global %d", client, id);
|
||||||
if (global == NULL)
|
pw_map_for_each(&client->objects, error_resource, &d);
|
||||||
return -ENOENT;
|
|
||||||
|
|
||||||
spa_list_for_each_safe(r, t, &global->resource_list, link) {
|
|
||||||
if (t->client != client)
|
|
||||||
continue;
|
|
||||||
pw_resource_error(r, res, error);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue