dovecot-2.0-sslstream: lmtp: Disable idle timeout while proxying.
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 13 02:56:11 EET 2010
details: http://hg.dovecot.org/dovecot-2.0-sslstream/rev/cb7b2901f1f8
changeset: 10284:cb7b2901f1f8
user: Timo Sirainen <tss at iki.fi>
date: Mon Nov 09 18:54:40 2009 -0500
description:
lmtp: Disable idle timeout while proxying.
diffstat:
3 files changed, 17 insertions(+), 11 deletions(-)
src/lmtp/client.c | 20 ++++++++++++++------
src/lmtp/client.h | 2 +-
src/lmtp/commands.c | 6 ++----
diffs (88 lines):
diff -r 7215f4142901 -r cb7b2901f1f8 src/lmtp/client.c
--- a/src/lmtp/client.c Mon Nov 09 18:41:59 2009 -0500
+++ b/src/lmtp/client.c Mon Nov 09 18:54:40 2009 -0500
@@ -112,7 +112,7 @@ void client_input_handle(struct client *
o_stream_unref(&output);
}
-void client_input(struct client *client)
+static void client_input(struct client *client)
{
if (client_input_read(client) < 0)
return;
@@ -186,6 +186,16 @@ static const char *client_remote_id(stru
if (addr == NULL)
addr = "local";
return addr;
+}
+
+void client_io_reset(struct client *client)
+{
+ if (client->io != NULL)
+ io_remove(&client->io);
+ client->io = io_add(client->fd_in, IO_READ, client_input, client);
+ client->last_input = ioloop_time;
+ client->to_idle = timeout_add(CLIENT_IDLE_TIMEOUT_MSECS,
+ client_idle_timeout, client);
}
struct client *client_create(int fd_in, int fd_out,
@@ -210,10 +220,7 @@ struct client *client_create(int fd_in,
client->input = i_stream_create_fd(fd_in, CLIENT_MAX_INPUT_SIZE, FALSE);
client->output = o_stream_create_fd(fd_out, (size_t)-1, FALSE);
- client->io = io_add(fd_in, IO_READ, client_input, client);
- client->last_input = ioloop_time;
- client->to_idle = timeout_add(CLIENT_IDLE_TIMEOUT_MSECS,
- client_idle_timeout, client);
+ client_io_reset(client);
client->my_domain = my_hostname;
client->state_pool = pool_alloconly_create("client state", 4096);
client->state.mail_data_fd = -1;
@@ -245,7 +252,8 @@ void client_destroy(struct client *clien
lmtp_proxy_deinit(&client->proxy);
if (client->io != NULL)
io_remove(&client->io);
- timeout_remove(&client->to_idle);
+ if (client->to_idle != NULL)
+ timeout_remove(&client->to_idle);
i_stream_destroy(&client->input);
o_stream_destroy(&client->output);
diff -r 7215f4142901 -r cb7b2901f1f8 src/lmtp/client.h
--- a/src/lmtp/client.h Mon Nov 09 18:41:59 2009 -0500
+++ b/src/lmtp/client.h Mon Nov 09 18:54:40 2009 -0500
@@ -73,9 +73,9 @@ void client_destroy(struct client *clien
const char *reason);
void client_disconnect(struct client *client, const char *prefix,
const char *reason);
+void client_io_reset(struct client *client);
void client_state_reset(struct client *client);
-void client_input(struct client *client);
void client_input_handle(struct client *client);
int client_input_read(struct client *client);
diff -r 7215f4142901 -r cb7b2901f1f8 src/lmtp/commands.c
--- a/src/lmtp/commands.c Mon Nov 09 18:41:59 2009 -0500
+++ b/src/lmtp/commands.c Mon Nov 09 18:54:40 2009 -0500
@@ -593,10 +593,7 @@ client_input_data_write_local(struct cli
static void client_input_data_finish(struct client *client)
{
- if (client->io != NULL)
- io_remove(&client->io);
- client->io = io_add(client->fd_in, IO_READ, client_input, client);
-
+ client_io_reset(client);
client_state_reset(client);
if (i_stream_have_bytes_left(client->input))
client_input_handle(client);
@@ -754,6 +751,7 @@ int cmd_data(struct client *client, cons
io_remove(&client->io);
if (array_count(&client->state.rcpt_to) == 0) {
+ timeout_remove(&client->to_idle);
lmtp_proxy_start(client->proxy, client->dot_input,
client_proxy_finish, client);
i_stream_unref(&client->dot_input);
More information about the dovecot-cvs
mailing list