Mercurial > dovecot > original-hg > dovecot-1.2
diff src/imap/client.c @ 2425:8267d11cacfb HEAD
LIST command interrupts itself when output buffer gets full and continues
again when there's space.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 18 Aug 2004 08:13:47 +0300 |
parents | d141e1bfdd63 |
children | e1616067df5c |
line wrap: on
line diff
--- a/src/imap/client.c Wed Aug 18 08:10:45 2004 +0300 +++ b/src/imap/client.c Wed Aug 18 08:13:47 2004 +0300 @@ -96,13 +96,23 @@ client_disconnect(client); } -void client_send_line(struct client *client, const char *data) +int client_send_line(struct client *client, const char *data) { + struct const_iovec iov[2]; + if (client->output->closed) - return; + return -1; - (void)o_stream_send_str(client->output, data); - (void)o_stream_send(client->output, "\r\n", 2); + iov[0].iov_base = data; + iov[0].iov_len = strlen(data); + iov[1].iov_base = "\r\n"; + iov[1].iov_len = 2; + + if (o_stream_sendv(client->output, iov, 2) < 0) + return -1; + + return o_stream_get_buffer_used_size(client->output) < + CLIENT_OUTPUT_OPTIMAL_SIZE; } void client_send_tagline(struct client *client, const char *data)