client-writer.c (dovecot-2.3.16) | : | client-writer.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
#include "lib-event-private.h" | #include "lib-event-private.h" | |||
#include "event-filter.h" | #include "event-filter.h" | |||
#include "ostream.h" | #include "ostream.h" | |||
#include "connection.h" | #include "connection.h" | |||
#include "master-service.h" | #include "master-service.h" | |||
#include "stats-event-category.h" | #include "stats-event-category.h" | |||
#include "stats-metrics.h" | #include "stats-metrics.h" | |||
#include "stats-settings.h" | #include "stats-settings.h" | |||
#include "client-writer.h" | #include "client-writer.h" | |||
#define STATS_UPDATE_CLIENTS_DELAY_MSECS 1000 | ||||
struct stats_event { | struct stats_event { | |||
struct stats_event *prev, *next; | struct stats_event *prev, *next; | |||
uint64_t id; | uint64_t id; | |||
struct event *event; | struct event *event; | |||
}; | }; | |||
struct writer_client { | struct writer_client { | |||
struct connection conn; | struct connection conn; | |||
struct stats_event *events; | struct stats_event *events; | |||
HASH_TABLE(struct stats_event *, struct stats_event *) events_hash; | HASH_TABLE(struct stats_event *, struct stats_event *) events_hash; | |||
}; | }; | |||
static struct timeout *to_update_clients; | ||||
static struct connection_list *writer_clients = NULL; | static struct connection_list *writer_clients = NULL; | |||
static void client_writer_send_handshake(struct writer_client *client) | static void client_writer_send_handshake(struct writer_client *client) | |||
{ | { | |||
string_t *filter = t_str_new(128); | string_t *filter = t_str_new(128); | |||
string_t *str = t_str_new(128); | string_t *str = t_str_new(128); | |||
event_filter_export(stats_metrics_get_event_filter(stats_metrics), filter ); | event_filter_export(stats_metrics_get_event_filter(stats_metrics), filter ); | |||
str_append(str, "FILTER\t"); | str_append(str, "FILTER\t"); | |||
skipping to change at line 319 | skipping to change at line 322 | |||
.input_max_size = 1024*128, /* "big enough" */ | .input_max_size = 1024*128, /* "big enough" */ | |||
.output_max_size = SIZE_MAX, | .output_max_size = SIZE_MAX, | |||
.client = FALSE, | .client = FALSE, | |||
}; | }; | |||
static const struct connection_vfuncs client_vfuncs = { | static const struct connection_vfuncs client_vfuncs = { | |||
.destroy = writer_client_destroy, | .destroy = writer_client_destroy, | |||
.input_args = writer_client_input_args, | .input_args = writer_client_input_args, | |||
}; | }; | |||
static void | ||||
client_writer_update_connections_internal(void *context ATTR_UNUSED) | ||||
{ | ||||
struct connection *conn; | ||||
for (conn = writer_clients->connections; conn != NULL; conn = conn->next) | ||||
{ | ||||
struct writer_client *client = | ||||
container_of(conn, struct writer_client, conn); | ||||
client_writer_send_handshake(client); | ||||
} | ||||
timeout_remove(&to_update_clients); | ||||
} | ||||
void client_writer_update_connections(void) | ||||
{ | ||||
if (to_update_clients != NULL) | ||||
return; | ||||
to_update_clients = timeout_add(STATS_UPDATE_CLIENTS_DELAY_MSECS, | ||||
client_writer_update_connections_internal | ||||
, | ||||
NULL); | ||||
} | ||||
void client_writers_init(void) | void client_writers_init(void) | |||
{ | { | |||
writer_clients = connection_list_init(&client_set, &client_vfuncs); | writer_clients = connection_list_init(&client_set, &client_vfuncs); | |||
} | } | |||
void client_writers_deinit(void) | void client_writers_deinit(void) | |||
{ | { | |||
timeout_remove(&to_update_clients); | ||||
connection_list_deinit(&writer_clients); | connection_list_deinit(&writer_clients); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 27 lines changed or added |