From 632ac992ab4a032a3415b99a419c0c88c22157e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sat, 10 Sep 2022 17:37:19 +0200 Subject: xC/xP: only send buffer stats in the initial sync The client and frontends track these separately, there is no need for hard synchronization. --- xC.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'xC.c') diff --git a/xC.c b/xC.c index 2644bce..13cd57d 100644 --- a/xC.c +++ b/xC.c @@ -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) { -- cgit v1.2.3