diff src/indexer/indexer-client.c @ 13192:af8c5e56d098

indexer: If verbose_proctitle=yes, show how many clients/requests there are.
author Timo Sirainen <tss@iki.fi>
date Tue, 09 Aug 2011 19:42:23 +0300
parents 268f76a75e51
children 8dcb7c7f66d5
line wrap: on
line diff
--- a/src/indexer/indexer-client.c	Tue Aug 09 19:28:00 2011 +0300
+++ b/src/indexer/indexer-client.c	Tue Aug 09 19:42:23 2011 +0300
@@ -39,6 +39,7 @@
 };
 
 struct indexer_client *clients = NULL;
+static unsigned int clients_count = 0;
 
 static void indexer_client_destroy(struct indexer_client *client);
 static void indexer_client_ref(struct indexer_client *client);
@@ -173,7 +174,10 @@
 	client->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE);
 	client->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
 	client->io = io_add(fd, IO_READ, indexer_client_input, client);
+
 	DLLIST_PREPEND(&clients, client);
+	clients_count++;
+	indexer_refresh_proctitle();
 	return client;
 }
 
@@ -193,7 +197,9 @@
 	client->fd = -1;
 	indexer_client_unref(client);
 
+	clients_count--;
 	master_service_client_connection_destroyed(master_service);
+	indexer_refresh_proctitle();
 }
 
 static void indexer_client_ref(struct indexer_client *client)
@@ -214,6 +220,11 @@
 	i_free(client);
 }
 
+unsigned int indexer_clients_get_count(void)
+{
+	return clients_count;
+}
+
 void indexer_clients_destroy_all(void)
 {
 	while (clients != NULL)