changeset 3601:edc6e213048f HEAD

client_send_line(): Try flushing output immediately if buffer gets full.
author Timo Sirainen <tss@iki.fi>
date Sat, 24 Sep 2005 12:47:58 +0300
parents 33e3b0899b47
children c6ebda431efa
files src/imap/client.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/client.c	Fri Sep 23 16:28:40 2005 +0300
+++ b/src/imap/client.c	Sat Sep 24 12:47:58 2005 +0300
@@ -117,8 +117,12 @@
 	if (o_stream_sendv(client->output, iov, 2) < 0)
 		return -1;
 
-	return o_stream_get_buffer_used_size(client->output) <
-		CLIENT_OUTPUT_OPTIMAL_SIZE;
+	if (o_stream_get_buffer_used_size(client->output) >=
+	    CLIENT_OUTPUT_OPTIMAL_SIZE) {
+		/* buffer full, try flushing */
+		return o_stream_flush(client->output);
+	}
+	return 1;
 }
 
 void client_send_tagline(struct client_command_context *cmd, const char *data)