dovecot-2.2: lib-lda: Added smtp_client_deinit_timeout() to give...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Mar 6 14:34:04 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/bf2dbc8ec74b
changeset: 18302:bf2dbc8ec74b
user: Timo Sirainen <tss at iki.fi>
date: Fri Mar 06 16:32:05 2015 +0200
description:
lib-lda: Added smtp_client_deinit_timeout() to give a session timeout.
diffstat:
src/lib-lda/smtp-client.c | 12 ++++++++++--
src/lib-lda/smtp-client.h | 3 +++
2 files changed, 13 insertions(+), 2 deletions(-)
diffs (56 lines):
diff -r 9a384f83b2a3 -r bf2dbc8ec74b src/lib-lda/smtp-client.c
--- a/src/lib-lda/smtp-client.c Fri Mar 06 16:30:55 2015 +0200
+++ b/src/lib-lda/smtp-client.c Fri Mar 06 16:32:05 2015 +0200
@@ -248,7 +248,8 @@
}
static int
-smtp_client_send_flush(struct smtp_client *smtp_client, const char **error_r)
+smtp_client_send_flush(struct smtp_client *smtp_client,
+ unsigned int timeout_secs, const char **error_r)
{
struct lmtp_client_settings client_set;
struct lmtp_client *client;
@@ -285,6 +286,7 @@
client_set.mail_from = smtp_client->return_path == NULL ? "<>" :
t_strconcat("<", smtp_client->return_path, ">", NULL);
client_set.my_hostname = smtp_client->set->hostname;
+ client_set.timeout_secs = timeout_secs;
ioloop = io_loop_create();
client = lmtp_client_init(&client_set, smtp_client_send_finished,
@@ -344,6 +346,12 @@
int smtp_client_deinit(struct smtp_client *client, const char **error_r)
{
+ return smtp_client_deinit_timeout(client, 0, error_r);
+}
+
+int smtp_client_deinit_timeout(struct smtp_client *client,
+ unsigned int timeout_secs, const char **error_r)
+{
int ret;
if (!client->use_smtp) {
@@ -355,7 +363,7 @@
}
/* the mail has been written to a file. now actually send it. */
- ret = smtp_client_send_flush(client, error_r);
+ ret = smtp_client_send_flush(client, timeout_secs, error_r);
smtp_client_abort(&client);
return ret;
diff -r 9a384f83b2a3 -r bf2dbc8ec74b src/lib-lda/smtp-client.h
--- a/src/lib-lda/smtp-client.h Fri Mar 06 16:30:55 2015 +0200
+++ b/src/lib-lda/smtp-client.h Fri Mar 06 16:32:05 2015 +0200
@@ -12,6 +12,9 @@
/* Returns 1 on success, 0 on permanent failure (e.g. invalid destination),
-1 on temporary failure. */
int smtp_client_deinit(struct smtp_client *client, const char **error_r);
+/* Same as smtp_client_deinit(), but timeout after given number of seconds. */
+int smtp_client_deinit_timeout(struct smtp_client *client,
+ unsigned int timeout_secs, const char **error_r);
/* FIXME: obsolete API, remove in v2.3: */
struct smtp_client * ATTR_NULL(3)
More information about the dovecot-cvs
mailing list