When the resource does add_listener, send a message to the proxy
to trigger an emission of properties.
Block the client until all properties have been notified, track
this with a ping event to the implementation.
Abuse the xrun callback in the adapter to emit the drained signal until
almost all data left the resampler. This needs more work with a proper
signal and a buffer flag to signal the drain.
The info structure needs to be cached because there is no way to
request it from the implementation, unless we hack the add_listener
API to be used for making info requests or add a new method that
will be used just in the implementation (both are bad ideas).
The params are cached because
1) a client doing enum_params + sync will not work correctly, since
the sync call syncs with the server and not the implementation...
we could block the client to solve that, but then there is also #2
2) the implementation is not aware of the clients and therefore
it cannot keep track of who is subscribed and who is not, this
needs to happen in the server. Then if we only keep track of the
subscriptions in the server and keep requesting params from the
impl, there is no way to know if a param event coming from the
impl matches a call to enum_params or to subscribe or if it's
just an update that needs to be forwarded to subscribers.
Always iterate all params because we are only supposed to
return -ENOENT for unknown params and if we start iterating at some
random start position we might be past the paran and report -ENOENT
wrongly.
When the global is destroyed, free the resource.
When the resource is freed, destroy the global.
Make sure any bound resources are freed when the global is destroyed
by calling pw_global_add_resource().
Send create_object error messages to the new resource id so that
the client can better know what proxy is failing.
Use resource_remove when create_object fails because the core will
already send a remove_id on failure.
Try to send other errors to the proxy that made the request if
possible.
Sending the errors to the proxy id allows the client to know something
is wrong with the proxy and deal with it better.
Use the port global id in the error message.
When the client uploads a buffer, copy all data fields except for
the chunk memory that we configured before.
If we overwrite the chunk memory, the users of the buffer would not
be able to find the chunk memory anymore and crash or fail.
A missing XDG_RUNTIME_DIR results in ENOENT, like on the server
side.
A too long name results in ENAMETOOLONG, like on the server side.
When we can't find the socket, return EHOSTDOWN to make it more
obvious what is going.
Log an error when we send an error to the client so that we don't need
to log and error anymore.
Improve the error messages when we can
Move some warnings and errors to debug
The socket call does not terminate the string with '\0' so
we have to use the length explicitly.
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
enum_param should return -ENOENT when the param is not known.
When negotiating buffers handle -ENOENT. This means the port does
not know about the property and we should assume anything is fine
so just use the filter from the first port.