Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3469:7e39590da48a HEAD
Call t_push/t_pop around client command execution function, so if client
sends multiple commands at once we don't waste memory.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 04 Jul 2005 00:35:18 +0300 |
parents | 3e1d7dffb3a2 |
children | 346a494c2feb |
files | src/imap/client.c src/pop3/client.c |
diffstat | 2 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/client.c Mon Jul 04 00:19:44 2005 +0300 +++ b/src/imap/client.c Mon Jul 04 00:35:18 2005 +0300 @@ -352,6 +352,7 @@ { struct client *client = context; struct client_command_context *cmd = &client->cmd; + int ret; if (client->command_pending) { /* already processing one command. wait. */ @@ -380,8 +381,11 @@ } o_stream_cork(client->output); - while (client_handle_input(cmd)) - ; + do { + t_push(); + ret = client_handle_input(cmd); + t_pop(); + } while (ret); o_stream_uncork(client->output); if (client->command_pending)
--- a/src/pop3/client.c Mon Jul 04 00:19:44 2005 +0300 +++ b/src/pop3/client.c Mon Jul 04 00:35:18 2005 +0300 @@ -317,6 +317,7 @@ { struct client *client = context; char *line, *args; + int ret; if (client->cmd != NULL) { /* we're still processing a command. wait until it's @@ -351,7 +352,10 @@ else *args++ = '\0'; - if (client_command_execute(client, line, args) >= 0) { + t_push(); + ret = client_command_execute(client, line, args); + t_pop(); + if (ret >= 0) { client->bad_counter = 0; if (client->cmd != NULL) { o_stream_set_flush_pending(client->output,