global: update generation number also in clients without registry

Not all clients have an existing registry, and the registry generation
number will not be updated for them.  However, we would like to check
for stale globals also elsewhere, eg.  metadata, and it must work also
in this case.

To avoid failing to update client registry generation, on global
addition which the client would see if it had a registry, send done
message for the new global id instead.
This commit is contained in:
Pauli Virtanen 2022-02-22 22:18:20 +02:00
parent a9accd1668
commit d71cf24183
4 changed files with 30 additions and 8 deletions

View file

@ -95,8 +95,8 @@ void marshal_client_footers(struct footer_client_global_state *state, struct pw_
{
struct footer_builder fb = FOOTER_BUILDER_INIT(builder);
if (client->context->generation != state->last_sent_generation) {
state->last_sent_generation = client->context->generation;
if (client->context->generation != client->sent_generation) {
client->sent_generation = client->context->generation;
pw_log_trace("impl-client %p: send server registry generation:%"PRIu64,
client, client->context->generation);
@ -117,10 +117,11 @@ int demarshal_core_generation(void *object, struct spa_pod_parser *parser)
if (spa_pod_parser_get_long(parser, &generation) < 0)
return -EINVAL;
core->recv_generation = (uint64_t)generation;
core->recv_generation = SPA_MAX(core->recv_generation,
(uint64_t)generation);
pw_log_trace("core %p: recv server registry generation:%"PRIu64,
core->core, generation);
core, generation);
return 0;
}
@ -133,7 +134,8 @@ int demarshal_client_generation(void *object, struct spa_pod_parser *parser)
if (spa_pod_parser_get_long(parser, &generation) < 0)
return -EINVAL;
client->recv_generation = (uint64_t)generation;
client->recv_generation = SPA_MAX(client->recv_generation,
(uint64_t)generation);
pw_log_trace("impl-client %p: recv client registry generation:%"PRIu64,
client, generation);

View file

@ -44,7 +44,6 @@ struct footer_core_global_state {
};
struct footer_client_global_state {
uint64_t last_sent_generation;
};
struct footer_demarshal {