dovecot-2.1: doveadm-server: Make sure another command isn't sta...

dovecot at dovecot.org dovecot at dovecot.org
Wed Aug 1 23:14:33 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/476381017ec7
changeset: 14656:476381017ec7
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Aug 01 23:14:19 2012 +0300
description:
doveadm-server: Make sure another command isn't started before previous one is finished.

diffstat:

 src/doveadm/client-connection.c |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r 323d6ce62567 -r 476381017ec7 src/doveadm/client-connection.c
--- a/src/doveadm/client-connection.c	Wed Aug 01 22:43:45 2012 +0300
+++ b/src/doveadm/client-connection.c	Wed Aug 01 23:14:19 2012 +0300
@@ -21,6 +21,8 @@
 
 #define MAX_INBUF_SIZE 1024
 
+static void client_connection_input(struct client_connection *conn);
+
 struct client_connection {
 	pool_t pool;
 
@@ -208,6 +210,10 @@
 		return FALSE;
 	}
 
+	/* make sure client_connection_input() isn't called by the ioloop that
+	   is going to be run by doveadm_mail_cmd_server_run() */
+	io_remove(&conn->io);
+
 	o_stream_cork(conn->output);
 	ctx = doveadm_mail_cmd_server_parse(cmd_name, conn->set, &input, argc, args);
 	if (ctx == NULL)
@@ -220,6 +226,8 @@
 	net_set_nonblock(conn->fd, FALSE);
 	(void)o_stream_flush(conn->output);
 	net_set_nonblock(conn->fd, TRUE);
+
+	conn->io = io_add(conn->fd, IO_READ, client_connection_input, conn);
 	return TRUE;
 }
 


More information about the dovecot-cvs mailing list