]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lda/lmtp: Added a hardcoded LDA_SUBMISSION_TIMEOUT_SECS=30 timeout for SMTP client.
authorTimo Sirainen <tss@iki.fi>
Fri, 6 Mar 2015 14:33:23 +0000 (16:33 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 6 Mar 2015 14:33:23 +0000 (16:33 +0200)
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..

src/lda/main.c
src/lib-lda/mail-deliver.h
src/lib-lda/mail-send.c
src/lmtp/commands.c

index 64e69723ace27289cc92b322593c0361f2d650ac..ccf5ed3216f43ca26de1dbc2776fa494d2a28d57 100644 (file)
@@ -315,6 +315,7 @@ int main(int argc, char *argv[])
        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");
index f0646a22724eccd4d9f7a1518463e3a3e4f7f928..d3e87ff97bf8dfd2755f18c2a9d1cb06b07f0ee2 100644 (file)
@@ -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 @@ struct mail_deliver_context {
        pool_t pool;
        const struct lda_settings *set;
        struct mail_deliver_session *session;
+       unsigned int timeout_secs;
 
        struct duplicate_context *dup_ctx;
 
index 59d57ee554746ed33361ee2fd6dd6879a3f8f1ce..19309dbfc6ba3ab20e004eb3d0989f14b4327163 100644 (file)
@@ -180,7 +180,7 @@ int mail_send_rejection(struct mail_deliver_context *ctx, const char *recipient,
     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));
index 0198cd6516190a2bd7a8490556543a1e96791bdc..289c186e1b09f4c766418c7550f7a4dc896055f5 100644 (file)
@@ -803,6 +803,7 @@ client_deliver(struct client *client, const struct mail_recipient *rcpt,
        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;