* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2024 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
/* SPDX-License-Identifier: GPL-2.0-or-later */
refer to the sender instead of recipients.
If queue_2stage is set, the queue is scanned twice. The first time, queue_smtp
-is set so that routing is done for all messages. Thus in the second run those
-that are routed to the same host should go down the same SMTP connection.
+is set so that routing is done for all messages. A call of the transport adds
+each message_id in turn to a list for the resulting host.
+Then in the second run those that are routed to the same host should all go down
+a single SMTP connection.
Arguments:
q queue-runner descriptor
{
BOOL force_delivery = q->queue_run_force
|| deliver_selectstring || deliver_selectstring_sender;
-const pcre2_code *selectstring_regex = NULL;
-const pcre2_code *selectstring_regex_sender = NULL;
-uschar *log_detail = NULL;
+const pcre2_code * selectstring_regex = NULL;
+const pcre2_code * selectstring_regex_sender = NULL;
+uschar * log_detail = NULL;
int subcount = 0;
uschar subdirs[64];
pid_t qpid[4] = {0}; /* Parallelism factor for q2stage 1st phase */
if (!recurse)
{
- uschar extras[8];
- uschar *p = extras;
+ uschar extras[8], * p = extras;
if (q->queue_2stage) *p++ = 'q';
if (q->queue_run_first_delivery) *p++ = 'i';
if (q->queue_run_force) *p++ = 'f';
if (q->deliver_force_thaw) *p++ = 'f';
if (q->queue_run_local) *p++ = 'l';
- *p = 0;
+ *p = '\0';
p = big_buffer;
p += sprintf(CS p, "pid=%d", (int)queue_run_pid);
- if (extras[0] != 0)
+ if (*extras)
p += sprintf(CS p, " -q%s", extras);
if (deliver_selectstring)
selectstring_regex_sender =
regex_must_compile(deliver_selectstring_sender, MCS_CASELESS, FALSE);
+#ifndef DISABLE_TLS
+if (!queue_tls_init)
+ {
+ queue_tls_init = TRUE;
+ /* Preload TLS library info for smtp transports. */
+ tls_client_creds_reload(FALSE);
+ }
+#endif
+
/* If the spool is split into subdirectories, we want to process it one
directory at a time, so as to spread out the directory scanning and the
delivering when there are lots of messages involved, except when
name. The return of the process is zero if a delivery was attempted. */
fq->text[Ustrlen(fq->text)-2] = 0;
- set_process_info("running queue: %s", fq->text);
+ set_process_info("running queue%s: %s",
+ q->queue_2stage ? "(ph 1)" : "", fq->text);
#ifdef MEASURE_TIMING
report_time_since(×tamp_startup, US"queue msg selected");
#endif
-#ifndef DISABLE_TLS
- if (!queue_tls_init)
- {
- queue_tls_init = TRUE;
- /* Preload TLS library info for smtp transports. Once, and only if we
- have a delivery to do. */
- tls_client_creds_reload(FALSE);
- }
-#endif
-
single_item_retry:
- if ((pid = exim_fork(US"qrun-delivery")) == 0)
+ if ((pid = exim_fork(
+ q->queue_2stage ? US"qrun-p1-delivery" : US"qrun-delivery")) == 0)
{
int rc;
(void)close(pfd[pipe_read]);
else break;
#ifdef MEASURE_TIMING
- report_time_since(×tamp_startup, US"queue_run 1st phase done");
+ report_time_since(×tamp_startup, US"queue_run phase 1 done");
#endif
q->queue_2stage = f.queue_2stage = FALSE;
+ DEBUG(D_queue_run) debug_printf("queue_run phase 2 start\n");
queue_run(q, start_id, stop_id, TRUE);
}
#endif /*!COMPILE_UTILITY*/
/* End of queue.c */
+/* vi: aw ai sw=2
+*/