pulse-server: client: do not drop partially sent messages

If the first message has already been partially sent, do not
drop it when looking for redundant messages.
This commit is contained in:
Barnabás Pőcze 2021-11-11 12:39:49 +01:00 committed by Wim Taymans
parent 4678ea06a0
commit 2d4febaba1

View file

@ -292,11 +292,13 @@ int client_flush_messages(struct client *client)
static bool client_prune_subscribe_events(struct client *client, uint32_t mask, uint32_t event, uint32_t id)
{
struct impl *impl = client->impl;
struct message *m, *t;
struct message *m, *t, *first;
if ((event & SUBSCRIPTION_EVENT_TYPE_MASK) == SUBSCRIPTION_EVENT_NEW)
return false;
first = spa_list_first(&client->out_messages, struct message, link);
spa_list_for_each_safe_reverse(m, t, &client->out_messages, link) {
if (m->extra[0] != COMMAND_SUBSCRIBE_EVENT)
continue;
@ -309,9 +311,12 @@ static bool client_prune_subscribe_events(struct client *client, uint32_t mask,
/* This object is being removed, hence there is
* point in keeping the old events regarding
* entry in the queue. */
/* if the first message has already been partially sent, do not drop it */
if (m != first || client->out_index == 0) {
message_free(impl, m, true, false);
pw_log_debug("client %p: dropped redundant event due to remove event", client);
continue;
}
}
if ((event & SUBSCRIPTION_EVENT_TYPE_MASK) == SUBSCRIPTION_EVENT_CHANGE) {