mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: handle message errors
This commit is contained in:
parent
bb8bd3d76d
commit
bc1192c8dd
2 changed files with 21 additions and 0 deletions
|
|
@ -500,6 +500,9 @@ static int message_put(struct message *m, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
|
if (m == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
va_start(va, m);
|
va_start(va, m);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
@ -557,5 +560,8 @@ static int message_put(struct message *m, ...)
|
||||||
}
|
}
|
||||||
va_end(va);
|
va_end(va);
|
||||||
|
|
||||||
|
if (m->length > m->allocated)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,17 @@ static int send_message(struct client *client, struct message *m)
|
||||||
struct impl *impl = client->impl;
|
struct impl *impl = client->impl;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
if (m == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (m->length == 0) {
|
||||||
|
res = 0;
|
||||||
|
goto error;
|
||||||
|
} else if (m->length > m->allocated) {
|
||||||
|
res = -ENOMEM;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
m->offset = 0;
|
m->offset = 0;
|
||||||
spa_list_append(&client->out_messages, &m->link);
|
spa_list_append(&client->out_messages, &m->link);
|
||||||
res = flush_messages(client);
|
res = flush_messages(client);
|
||||||
|
|
@ -282,6 +293,10 @@ static int send_message(struct client *client, struct message *m)
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
error:
|
||||||
|
if (m)
|
||||||
|
message_free(client, m, false, false);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct message *reply_new(struct client *client, uint32_t tag)
|
static struct message *reply_new(struct client *client, uint32_t tag)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue