dovecot-2.2: lda/lmtp: Added a hardcoded LDA_SUBMISSION_TIMEOUT_...

dovecot at dovecot.org dovecot at dovecot.org
Fri Mar 6 14:34:09 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/73e013bc64a4
changeset: 18303:73e013bc64a4
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Mar 06 16:33:23 2015 +0200
description:
lda/lmtp: Added a hardcoded LDA_SUBMISSION_TIMEOUT_SECS=30 timeout for SMTP client.
Maybe we could have a new setting if needed later on, but we've been working
pretty successfully without any timeout for a long time..

diffstat:

 src/lda/main.c             |  1 +
 src/lib-lda/mail-deliver.h |  5 +++++
 src/lib-lda/mail-send.c    |  2 +-
 src/lmtp/commands.c        |  1 +
 4 files changed, 8 insertions(+), 1 deletions(-)

diffs (56 lines):

diff -r bf2dbc8ec74b -r 73e013bc64a4 src/lda/main.c
--- a/src/lda/main.c	Fri Mar 06 16:32:05 2015 +0200
+++ b/src/lda/main.c	Fri Mar 06 16:33:23 2015 +0200
@@ -315,6 +315,7 @@
 	ctx.session = mail_deliver_session_init();
 	ctx.pool = ctx.session->pool;
 	ctx.dest_mailbox_name = "INBOX";
+	ctx.timeout_secs = LDA_SUBMISSION_TIMEOUT_SECS;
 	path = NULL;
 
 	user = getenv("USER");
diff -r bf2dbc8ec74b -r 73e013bc64a4 src/lib-lda/mail-deliver.h
--- a/src/lib-lda/mail-deliver.h	Fri Mar 06 16:32:05 2015 +0200
+++ b/src/lib-lda/mail-deliver.h	Fri Mar 06 16:33:23 2015 +0200
@@ -5,6 +5,10 @@
 #include "mail-types.h"
 #include "mail-error.h"
 
+/* How many seconds to wait for replies from SMTP before failing. Used for
+   sending rejects, forward, etc. */
+#define LDA_SUBMISSION_TIMEOUT_SECS 30
+
 struct mail_storage;
 struct mail_save_context;
 struct mailbox;
@@ -20,6 +24,7 @@
 	pool_t pool;
 	const struct lda_settings *set;
 	struct mail_deliver_session *session;
+	unsigned int timeout_secs;
 
 	struct duplicate_context *dup_ctx;
 
diff -r bf2dbc8ec74b -r 73e013bc64a4 src/lib-lda/mail-send.c
--- a/src/lib-lda/mail-send.c	Fri Mar 06 16:32:05 2015 +0200
+++ b/src/lib-lda/mail-send.c	Fri Mar 06 16:33:23 2015 +0200
@@ -180,7 +180,7 @@
     str_truncate(str, 0);
     str_printfa(str, "\r\n\r\n--%s--\r\n", boundary);
     o_stream_nsend(output, str_data(str), str_len(str));
-    if ((ret = smtp_client_deinit(smtp_client, &error)) < 0) {
+    if ((ret = smtp_client_deinit_timeout(smtp_client, ctx->timeout_secs, &error)) < 0) {
 	    i_error("msgid=%s: Temporarily failed to send rejection: %s",
 		    orig_msgid == NULL ? "" : str_sanitize(orig_msgid, 80),
 		    str_sanitize(error, 512));
diff -r bf2dbc8ec74b -r 73e013bc64a4 src/lmtp/commands.c
--- a/src/lmtp/commands.c	Fri Mar 06 16:32:05 2015 +0200
+++ b/src/lmtp/commands.c	Fri Mar 06 16:33:23 2015 +0200
@@ -803,6 +803,7 @@
 	dctx.session = session;
 	dctx.pool = session->pool;
 	dctx.set = lda_set;
+	dctx.timeout_secs = LDA_SUBMISSION_TIMEOUT_SECS;
 	dctx.session_id = client->state.session_id;
 	dctx.src_mail = src_mail;
 	dctx.src_envelope_sender = client->state.mail_from;


More information about the dovecot-cvs mailing list