[dovecot-cvs] dovecot/src/imap client.c, 1.49, 1.50 client.h, 1.25, 1.26 cmd-append.c, 1.48, 1.49

cras at dovecot.org cras at dovecot.org
Fri Nov 12 00:10:58 EET 2004


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv13755

Modified Files:
	client.c client.h cmd-append.c 
Log Message:
APPEND was using all CPU.



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- client.c	21 Oct 2004 02:36:29 -0000	1.49
+++ client.c	11 Nov 2004 22:10:56 -0000	1.50
@@ -15,8 +15,6 @@
 static struct client *my_client; /* we don't need more than one currently */
 static struct timeout *to_idle;
 
-static int client_output(void *context);
-
 struct client *client_create(int hin, int hout, struct namespace *namespaces)
 {
 	struct client *client;
@@ -31,7 +29,7 @@
 	client->output = o_stream_create_file(hout, default_pool,
 					      (size_t)-1, FALSE);
 
-	o_stream_set_flush_callback(client->output, client_output, client);
+	o_stream_set_flush_callback(client->output, _client_output, client);
 
 	client->io = io_add(hin, IO_READ, _client_input, client);
 	client->parser = imap_parser_create(client->input, client->output,
@@ -375,7 +373,7 @@
 		client_destroy(client);
 }
 
-static int client_output(void *context)
+int _client_output(void *context)
 {
 	struct client *client = context;
 	int ret, finished;

Index: client.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- client.h	21 Oct 2004 02:36:29 -0000	1.25
+++ client.h	11 Nov 2004 22:10:56 -0000	1.26
@@ -78,5 +78,6 @@
 
 void _client_reset_command(struct client *client);
 void _client_input(void *context);
+int _client_output(void *context);
 
 #endif

Index: cmd-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- cmd-append.c	11 Oct 2004 14:25:01 -0000	1.48
+++ cmd-append.c	11 Nov 2004 22:10:56 -0000	1.49
@@ -59,6 +59,8 @@
 		/* command execution was finished */
 		client->bad_counter = 0;
 		_client_reset_command(client);
+		o_stream_set_flush_callback(client->output,
+					    _client_output, client);
 
 		if (client->input_pending)
 			_client_input(client);
@@ -385,6 +387,10 @@
 	io_remove(client->io);
 	client->io = io_add(i_stream_get_fd(client->input), IO_READ,
 			    client_input, client);
+	/* append is special because we're only waiting on client input, not
+	   client output, so disable the standard output handler until we're
+	   finished */
+	o_stream_set_flush_callback(client->output, NULL, NULL);
 
 	ctx->save_parser = imap_parser_create(client->input, client->output,
 					      imap_max_line_length);



More information about the dovecot-cvs mailing list