spa: varlink: Set a default read timeout for sync calls

Makes sure we don't end up blocking forever, and timeouts are treated as
errors.
This commit is contained in:
Arun Raghavan 2026-04-24 11:54:48 -07:00
parent 7fb515d3ee
commit 4f798754e5
4 changed files with 17 additions and 11 deletions

View file

@ -79,10 +79,12 @@ struct spa_varlink_client {
* object).
* \param reply The reply string. The caller is responsible for freeing
* this data with `free()`
* \param timeout If non-negative, specifies how long (in milliseconds)
* to wait for a reply
* \return 0 on success, or a negative error code on failure.
*/
int (*call_sync) (void *object, const char *method, const char *params,
char **reply);
char **reply, int timeout);
/** Destroy a varlink client.
*
@ -117,10 +119,10 @@ spa_varlink_client_call(struct spa_varlink_client *client, const char *method,
* \sa spa_varlink_client_methods.call_sync */
SPA_API_VARLINK int
spa_varlink_client_call_sync(struct spa_varlink_client *client, const char *method,
const char *params, char **reply)
const char *params, char **reply, int timeout)
{
return spa_api_func_r(int, -EINVAL, client, call_sync, 0, method,
params, reply);
params, reply, timeout);
}
/** \copydoc spa_varlink_client_methods.destroy