dovecot-2.2: pop3: Fixed infinite looping
dovecot at dovecot.org
dovecot at dovecot.org
Fri Feb 22 16:21:33 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/dcbebe49922a
changeset: 15895:dcbebe49922a
user: Timo Sirainen <tss at iki.fi>
date: Fri Feb 22 16:21:20 2013 +0200
description:
pop3: Fixed infinite looping
diffstat:
src/pop3/pop3-client.c | 27 +++++++++------------------
src/pop3/pop3-client.h | 6 +++++-
2 files changed, 14 insertions(+), 19 deletions(-)
diffs (70 lines):
diff -r b3f890c4a41c -r dcbebe49922a src/pop3/pop3-client.c
--- a/src/pop3/pop3-client.c Fri Feb 22 16:03:00 2013 +0200
+++ b/src/pop3/pop3-client.c Fri Feb 22 16:21:20 2013 +0200
@@ -25,10 +25,6 @@
/* max. length of input command line (spec says 512) */
#define MAX_INBUF_SIZE 2048
-/* Stop reading input when output buffer has this many bytes. Once the buffer
- size has dropped to half of it, start reading input again. */
-#define OUTBUF_THROTTLE_SIZE 4096
-
/* Disconnect client when it sends too many bad commands in a row */
#define CLIENT_MAX_BAD_COMMANDS 20
@@ -643,21 +639,16 @@
i_assert(ret < 0 || (size_t)ret == str_len(str));
} T_END;
if (ret >= 0) {
- if (o_stream_get_buffer_used_size(client->output) <
- OUTBUF_THROTTLE_SIZE) {
+ if (!POP3_CLIENT_OUTPUT_FULL(client))
client->last_output = ioloop_time;
- } else {
- if (client->io != NULL) {
- /* no more input until client has read
- our output */
- io_remove(&client->io);
+ else if (client->io != NULL) {
+ /* no more input until client has read
+ our output */
+ io_remove(&client->io);
- /* If someone happens to flush output,
- we want to get our IO handler back in
- flush callback */
- o_stream_set_flush_pending(client->output,
- TRUE);
- }
+ /* If someone happens to flush output, we want to get
+ our IO handler back in flush callback */
+ o_stream_set_flush_pending(client->output, TRUE);
}
}
va_end(va);
@@ -775,7 +766,7 @@
if (client->cmd == NULL) {
if (o_stream_get_buffer_used_size(client->output) <
- OUTBUF_THROTTLE_SIZE/2 && client->io == NULL) {
+ POP3_OUTBUF_THROTTLE_SIZE/2 && client->io == NULL) {
/* enable input again */
client->io = io_add(i_stream_get_fd(client->input),
IO_READ, client_input, client);
diff -r b3f890c4a41c -r dcbebe49922a src/pop3/pop3-client.h
--- a/src/pop3/pop3-client.h Fri Feb 22 16:03:00 2013 +0200
+++ b/src/pop3/pop3-client.h Fri Feb 22 16:21:20 2013 +0200
@@ -9,8 +9,12 @@
#define MSGS_BITMASK_SIZE(client) \
(((client)->messages_count + (CHAR_BIT-1)) / CHAR_BIT)
+/* Stop reading input when output buffer has this many bytes. Once the buffer
+ size has dropped to half of it, start reading input again. */
+#define POP3_OUTBUF_THROTTLE_SIZE 4096
+
#define POP3_CLIENT_OUTPUT_FULL(client) \
- ((client)->io == NULL)
+ (o_stream_get_buffer_used_size((client)->output) >= POP3_OUTBUF_THROTTLE_SIZE)
struct pop3_client_vfuncs {
void (*destroy)(struct client *client, const char *reason);
More information about the dovecot-cvs
mailing list