Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2494:a2e2c76021b9 HEAD
Fixes for nonblocking changes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 25 Aug 2004 14:55:58 +0300 |
parents | 9ac27c8f2a72 |
children | ed7628af7865 |
files | src/pop3/client.c src/pop3/commands.c |
diffstat | 2 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pop3/client.c Wed Aug 25 11:25:03 2004 +0300 +++ b/src/pop3/client.c Wed Aug 25 14:55:58 2004 +0300 @@ -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__)
--- a/src/pop3/commands.c Wed Aug 25 11:25:03 2004 +0300 +++ b/src/pop3/commands.c Wed Aug 25 14:55:58 2004 +0300 @@ -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 */