[dovecot-cvs] dovecot/src/imap client.c,1.47,1.48
cras at dovecot.org
cras at dovecot.org
Wed Oct 20 20:07:34 EEST 2004
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv4344/imap
Modified Files:
client.c
Log Message:
Changed ostream's flush callback to have return value which can tell if
there are more bytes to be sent even if there is none in output buffer
itself. Fixes FETCH commands which used o_stream_send_istream() getting
stuck.
Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- client.c 19 Sep 2004 23:23:08 -0000 1.47
+++ client.c 20 Oct 2004 17:07:32 -0000 1.48
@@ -15,7 +15,7 @@
static struct client *my_client; /* we don't need more than one currently */
static struct timeout *to_idle;
-static void client_output(void *context);
+static int client_output(void *context);
struct client *client_create(int hin, int hout, struct namespace *namespaces)
{
@@ -375,32 +375,35 @@
client_destroy(client);
}
-static void client_output(void *context)
+static int client_output(void *context)
{
struct client *client = context;
- int finished;
+ int ret, finished;
- if (o_stream_flush(client->output) < 0) {
+ client->last_output = ioloop_time;
+
+ if ((ret = o_stream_flush(client->output)) < 0) {
client_destroy(client);
- return;
+ return 1;
}
- client->last_output = ioloop_time;
+ if (!client->command_pending)
+ return 1;
- if (client->command_pending) {
- o_stream_cork(client->output);
- finished = client->cmd_func(client) || client->cmd_param_error;
- o_stream_uncork(client->output);
+ /* continue processing command */
+ o_stream_cork(client->output);
+ finished = client->cmd_func(client) || client->cmd_param_error;
+ o_stream_uncork(client->output);
- if (finished) {
- /* command execution was finished */
- client->bad_counter = 0;
- _client_reset_command(client);
+ if (finished) {
+ /* command execution was finished */
+ client->bad_counter = 0;
+ _client_reset_command(client);
- if (client->input_pending)
- _client_input(client);
- }
+ if (client->input_pending)
+ _client_input(client);
}
+ return finished;
}
static void idle_timeout(void *context __attr_unused__)
More information about the dovecot-cvs
mailing list