dovecot-2.2: lib-lda: Added smtp_client_abort()
dovecot at dovecot.org
dovecot at dovecot.org
Thu Oct 9 09:02:59 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/90fbf199ebda
changeset: 17916:90fbf199ebda
user: Timo Sirainen <tss at iki.fi>
date: Thu Oct 09 12:02:21 2014 +0300
description:
lib-lda: Added smtp_client_abort()
diffstat:
src/lib-lda/smtp-client.c | 20 ++++++++++++++++++--
src/lib-lda/smtp-client.h | 1 +
2 files changed, 19 insertions(+), 2 deletions(-)
diffs (48 lines):
diff -r 10d11d9c0c98 -r 90fbf199ebda src/lib-lda/smtp-client.c
--- a/src/lib-lda/smtp-client.c Wed Oct 08 22:10:34 2014 +0300
+++ b/src/lib-lda/smtp-client.c Thu Oct 09 12:02:21 2014 +0300
@@ -324,6 +324,23 @@
}
}
+void smtp_client_abort(struct smtp_client **_client)
+{
+ struct smtp_client *client = *_client;
+
+ *_client = NULL;
+
+ o_stream_ignore_last_errors(client->output);
+ if (!client->use_smtp) {
+ if (client->pid != (pid_t)-1)
+ (void)kill(client->pid, SIGTERM);
+ (void)smtp_client_deinit_sendmail(client);
+ } else {
+ o_stream_destroy(&client->output);
+ pool_unref(&client->pool);
+ }
+}
+
int smtp_client_deinit(struct smtp_client *client, const char **error_r)
{
int ret;
@@ -339,8 +356,7 @@
/* the mail has been written to a file. now actually send it. */
ret = smtp_client_send_flush(client, error_r);
- o_stream_destroy(&client->output);
- pool_unref(&client->pool);
+ smtp_client_abort(&client);
return ret;
}
diff -r 10d11d9c0c98 -r 90fbf199ebda src/lib-lda/smtp-client.h
--- a/src/lib-lda/smtp-client.h Wed Oct 08 22:10:34 2014 +0300
+++ b/src/lib-lda/smtp-client.h Thu Oct 09 12:02:21 2014 +0300
@@ -8,6 +8,7 @@
/* Get an output stream where the message can be written to. The recipients
must already be added before calling this. */
struct ostream *smtp_client_send(struct smtp_client *client);
+void smtp_client_abort(struct smtp_client **client);
/* 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);
More information about the dovecot-cvs
mailing list