core: handle client bind errors

When a client attempts to bind to an unexisting global, don't error
but instead let the client know the object was removed.
This commit is contained in:
Wim Taymans 2017-03-09 15:52:19 +01:00
parent 7ad02f553a
commit 1e600713a5
6 changed files with 14 additions and 4 deletions

View file

@ -60,10 +60,13 @@ registry_bind (void *object,
return;
no_id:
pinos_core_notify_error (client->core_resource,
resource->id,
SPA_RESULT_INVALID_OBJECT_ID,
"unknown object id %u", id);
pinos_log_debug ("registry %p: no global with id %u to bind to %u", resource, id, new_id);
/* unmark the new_id the map, the client does not yet know about the failed
* bind and will choose the next id, which we would refuse when we don't mark
* new_id as 'used and freed' */
pinos_map_insert_at (&client->objects, new_id, NULL);
pinos_core_notify_remove_id (client->core_resource, new_id);
return;
}
static PinosRegistryMethods registry_methods = {
@ -128,6 +131,7 @@ core_get_registry (void *object,
return;
no_mem:
pinos_log_error ("can't create registry resource");
pinos_core_notify_error (client->core_resource,
resource->id,
SPA_RESULT_NO_MEMORY,
@ -195,6 +199,7 @@ core_create_client_node (void *object,
return;
no_mem:
pinos_log_error ("can't create client node");
pinos_core_notify_error (client->core_resource,
resource->id,
SPA_RESULT_NO_MEMORY,