[dovecot-cvs]
dovecot/src/pop3 client.c, 1.29, 1.30 commands.c, 1.20, 1.21
cras at dovecot.org
cras at dovecot.org
Wed Aug 25 14:56:00 EEST 2004
Update of /home/cvs/dovecot/src/pop3
In directory talvi:/tmp/cvs-serv17669
Modified Files:
client.c commands.c
Log Message:
Fixes for nonblocking changes.
Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/client.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- client.c 15 Aug 2004 03:40:32 -0000 1.29
+++ client.c 25 Aug 2004 11:55:58 -0000 1.30
@@ -325,15 +325,19 @@
client->last_output = ioloop_time;
+ if (client->cmd != NULL)
+ client->cmd(client);
+
if (o_stream_get_buffer_used_size(client->output) <
OUTBUF_THROTTLE_SIZE/2 && client->io == NULL &&
client->cmd == NULL) {
/* enable input again */
client->io = io_add(i_stream_get_fd(client->input), IO_READ,
client_input, client);
- if (client->waiting_input)
- client_input(client);
}
+
+ if (client->cmd == NULL && client->io != NULL && client->waiting_input)
+ client_input(client);
}
static void idle_timeout(void *context __attr_unused__)
Index: commands.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/commands.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- commands.c 15 Aug 2004 03:40:32 -0000 1.20
+++ commands.c 25 Aug 2004 11:55:58 -0000 1.21
@@ -249,9 +249,8 @@
const unsigned char *data;
unsigned char add;
size_t i, size;
- ssize_t ret;
- o_stream_set_max_buffer_size(client->output, 0);
+ o_stream_uncork(client->output);
while ((ctx->body_lines > 0 || !ctx->in_body) &&
i_stream_read_data(ctx->stream, &data, &size, 0) > 0) {
@@ -297,29 +296,26 @@
}
}
- if ((ret = o_stream_send(client->output, data, i)) < 0)
+ if (o_stream_send(client->output, data, i) < 0)
break;
- if (ret > 0)
- ctx->last = data[ret-1];
- i_stream_skip(ctx->stream, ret);
+ ctx->last = data[i-1];
+ i_stream_skip(ctx->stream, i);
- if ((size_t)ret != i) {
+ if (o_stream_get_buffer_used_size(client->output) > 0) {
/* continue later */
+ printf("plop\n");
return;
}
if (add != '\0') {
- if ((ret = o_stream_send(client->output, &add, 1)) < 0)
+ if (o_stream_send(client->output, &add, 1) < 0)
break;
- if (ret == 0)
- return;
ctx->last = add;
if (add == 0x80)
i_stream_skip(ctx->stream, 1);
}
}
- o_stream_set_max_buffer_size(client->output, (size_t)-1);
if (ctx->last != '\n') {
/* didn't end with CRLF */
More information about the dovecot-cvs
mailing list