dovecot-2.2: imap: If we're waiting for client to read data, sho...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 21 13:29:28 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/6b8620c6032c
changeset: 17385:6b8620c6032c
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 21 06:28:36 2014 -0700
description:
imap: If we're waiting for client to read data, show in process title how many bytes are buffered.

diffstat:

 src/imap/imap-client.c |   2 ++
 src/imap/main.c        |  18 ++++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diffs (58 lines):

diff -r 8ab8327400cd -r 6b8620c6032c src/imap/imap-client.c
--- a/src/imap/imap-client.c	Wed May 21 06:21:16 2014 -0700
+++ b/src/imap/imap-client.c	Wed May 21 06:28:36 2014 -0700
@@ -942,6 +942,7 @@
 	}
 	o_stream_uncork(output);
 	o_stream_unref(&output);
+	imap_refresh_proctitle();
 
 	if (client->disconnected)
 		client_destroy(client, NULL);
@@ -1017,6 +1018,7 @@
 	(void)cmd_sync_delayed(client);
 
 	o_stream_uncork(client->output);
+	imap_refresh_proctitle();
 	if (client->disconnected)
 		client_destroy(client, NULL);
 	else
diff -r 8ab8327400cd -r 6b8620c6032c src/imap/main.c
--- a/src/imap/main.c	Wed May 21 06:21:16 2014 -0700
+++ b/src/imap/main.c	Wed May 21 06:28:36 2014 -0700
@@ -51,6 +51,7 @@
 	struct client *client;
 	struct client_command_context *cmd;
 	string_t *title = t_str_new(128);
+	bool wait_output;
 
 	if (!verbose_proctitle)
 		return;
@@ -67,14 +68,23 @@
 			str_append_c(title, ' ');
 			str_append(title, net_ip2addr(client->user->remote_ip));
 		}
+		wait_output = FALSE;
 		for (cmd = client->command_queue; cmd != NULL; cmd = cmd->next) {
 			if (cmd->name == NULL)
 				continue;
 
-			if (str_len(title) > IMAP_PROCTITLE_PREFERRED_LEN)
-				break;
-			str_append_c(title, ' ');
-			str_append(title, cmd->name);
+			if (str_len(title) < IMAP_PROCTITLE_PREFERRED_LEN) {
+				str_append_c(title, ' ');
+				str_append(title, cmd->name);
+			}
+			if (cmd->state == CLIENT_COMMAND_STATE_WAIT_OUTPUT)
+				wait_output = TRUE;
+		}
+		if (wait_output) {
+			str_printfa(title, " - %"PRIuSIZE_T" bytes waiting",
+				    o_stream_get_buffer_used_size(client->output));
+			if (o_stream_is_corked(client->output))
+				str_append(title, " corked");
 		}
 		break;
 	default:


More information about the dovecot-cvs mailing list