pulse-server: client: do not queue messages after disconnect

Do not queue messages to be delivered to a client if
that client has already disconnected.
This commit is contained in:
Barnabás Pőcze 2021-11-11 11:43:28 +01:00 committed by Wim Taymans
parent d939fa5b1c
commit 5ef9deae83

View file

@ -182,6 +182,11 @@ int client_queue_message(struct client *client, struct message *msg)
if (msg == NULL) if (msg == NULL)
return -EINVAL; return -EINVAL;
if (client->disconnect) {
res = -ENOTCONN;
goto error;
}
if (msg->length == 0) { if (msg->length == 0) {
res = 0; res = 0;
goto error; goto error;
@ -212,6 +217,8 @@ int client_flush_messages(struct client *client)
struct impl *impl = client->impl; struct impl *impl = client->impl;
int res; int res;
spa_assert(!client->disconnect);
while (true) { while (true) {
struct message *m; struct message *m;
struct descriptor desc; struct descriptor desc;
@ -269,6 +276,9 @@ int client_queue_subscribe_event(struct client *client, uint32_t mask, uint32_t
struct impl *impl = client->impl; struct impl *impl = client->impl;
struct message *reply, *m, *t; struct message *reply, *m, *t;
if (client->disconnect)
return -ENOTCONN;
if (!(client->subscribed & mask)) if (!(client->subscribed & mask))
return 0; return 0;