xC/xP: only send buffer stats in the initial sync

The client and frontends track these separately,
there is no need for hard synchronization.
This commit is contained in:
2022-09-10 17:37:19 +02:00
parent d29e2cbfe8
commit 632ac992ab
3 changed files with 35 additions and 13 deletions

11
xC.c
View File

@@ -3068,6 +3068,15 @@ relay_prepare_buffer_update (struct app_context *ctx, struct buffer *buffer)
struct relay_event_data_buffer_update *e = &m->data.buffer_update;
e->event = RELAY_EVENT_BUFFER_UPDATE;
e->buffer_name = str_from_cstr (buffer->name);
}
static void
relay_prepare_buffer_stats (struct app_context *ctx, struct buffer *buffer)
{
struct relay_event_message *m = relay_prepare (ctx);
struct relay_event_data_buffer_stats *e = &m->data.buffer_stats;
e->event = RELAY_EVENT_BUFFER_STATS;
e->buffer_name = str_from_cstr (buffer->name);
e->new_messages = MIN (UINT32_MAX,
buffer->new_messages_count - buffer->new_unimportant_count);
e->new_unimportant_messages = MIN (UINT32_MAX,
@@ -15223,6 +15232,8 @@ client_resync (struct client *c)
{
relay_prepare_buffer_update (c->ctx, buffer);
relay_send (c);
relay_prepare_buffer_stats (c->ctx, buffer);
relay_send (c);
LIST_FOR_EACH (struct buffer_line, line, buffer->lines)
{