diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-05-08 13:26:13 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-05-09 14:17:47 +0100 |
commit | 0cd5fd23fdc042cd634a1033350bf91689f26d3c (patch) | |
tree | 9278795be8103b01fb86f301d90fd7273eb669ec /src | |
parent | fa665e0b7252b5916f0fbd57d6ef8c1f0a9b080f (diff) |
New $queue_name variable
queue_run_max main option expanded, allowing per-queue values
Diffstat (limited to 'src')
-rw-r--r-- | src/src/daemon.c | 20 | ||||
-rw-r--r-- | src/src/expand.c | 1 | ||||
-rw-r--r-- | src/src/globals.c | 2 | ||||
-rw-r--r-- | src/src/globals.h | 2 | ||||
-rw-r--r-- | src/src/readconf.c | 2 |
5 files changed, 13 insertions, 14 deletions
diff --git a/src/src/daemon.c b/src/src/daemon.c index 60ef33773..3634ad448 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -866,10 +866,10 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) /* If it wasn't an accepting process, see if it was a queue-runner process that we are tracking. */ - if (queue_pid_slots != NULL) + if (queue_pid_slots) { - for (i = 0; i < queue_run_max; i++) - { + int max = atoi(expand_string(queue_run_max)); + for (i = 0; i < max; i++) if (queue_pid_slots[i] == pid) { queue_pid_slots[i] = 0; @@ -878,7 +878,6 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) queue_run_count, (queue_run_count == 1)? "" : "es"); break; } - } } } } @@ -916,6 +915,7 @@ int *listen_sockets = NULL; int listen_socket_count = 0; ip_address_item *addresses = NULL; time_t last_connection_time = (time_t)0; +int local_queue_run_max = atoi(expand_string(queue_run_max)); /* If any debugging options are set, turn on the D_pid bit so that all debugging lines get the pid added. */ @@ -1572,11 +1572,11 @@ originator_login = ((pw = getpwuid(exim_uid)) != NULL)? /* Get somewhere to keep the list of queue-runner pids if we are keeping track of them (and also if we are doing queue runs). */ -if (queue_interval > 0 && queue_run_max > 0) +if (queue_interval > 0 && local_queue_run_max > 0) { int i; - queue_pid_slots = store_get(queue_run_max * sizeof(pid_t)); - for (i = 0; i < queue_run_max; i++) queue_pid_slots[i] = 0; + queue_pid_slots = store_get(local_queue_run_max * sizeof(pid_t)); + for (i = 0; i < local_queue_run_max; i++) queue_pid_slots[i] = 0; } /* Set up the handler for termination of child processes. */ @@ -1791,7 +1791,7 @@ for (;;) re-exec is required. */ if (queue_interval > 0 && - (queue_run_max <= 0 || queue_run_count < queue_run_max)) + (local_queue_run_max <= 0 || queue_run_count < local_queue_run_max)) { if ((pid = fork()) == 0) { @@ -1879,15 +1879,13 @@ for (;;) else { int i; - for (i = 0; i < queue_run_max; ++i) - { + for (i = 0; i < local_queue_run_max; ++i) if (queue_pid_slots[i] <= 0) { queue_pid_slots[i] = pid; queue_run_count++; break; } - } DEBUG(D_any) debug_printf("%d queue-runner process%s running\n", queue_run_count, (queue_run_count == 1)? "" : "es"); } diff --git a/src/src/expand.c b/src/src/expand.c index f783682b4..249254923 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -625,6 +625,7 @@ static var_entry var_table[] = { { "prvscheck_result", vtype_stringptr, &prvscheck_result }, { "qualify_domain", vtype_stringptr, &qualify_domain_sender }, { "qualify_recipient", vtype_stringptr, &qualify_domain_recipient }, + { "queue_name", vtype_stringptr, &queue_name }, { "rcpt_count", vtype_int, &rcpt_count }, { "rcpt_defer_count", vtype_int, &rcpt_defer_count }, { "rcpt_fail_count", vtype_int, &rcpt_fail_count }, diff --git a/src/src/globals.c b/src/src/globals.c index 8b2287aca..3ba82e0a7 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1031,7 +1031,7 @@ BOOL queue_run_first_delivery = FALSE; BOOL queue_run_force = FALSE; BOOL queue_run_in_order = FALSE; BOOL queue_run_local = FALSE; -int queue_run_max = 5; +uschar *queue_run_max = US"5"; pid_t queue_run_pid = (pid_t)0; int queue_run_pipe = -1; BOOL queue_running = FALSE; diff --git a/src/src/globals.h b/src/src/globals.h index bd7518074..362c2bfb9 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -677,7 +677,7 @@ extern uschar *queue_only_file; /* Queue if file exists/not-exists */ extern BOOL queue_only_override; /* Allow override from command line */ extern BOOL queue_only_policy; /* ACL or local_scan wants queue_only */ extern BOOL queue_run_in_order; /* As opposed to random */ -extern int queue_run_max; /* Max queue runners */ +extern uschar *queue_run_max; /* Max queue runners */ extern BOOL queue_smtp; /* Disable all immediate STMP (-odqs)*/ extern uschar *queue_smtp_domains; /* Ditto, for these domains */ diff --git a/src/src/readconf.c b/src/src/readconf.c index 375f01a1a..63a164122 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -374,7 +374,7 @@ static optionlist optionlist_config[] = { { "queue_only_load_latch", opt_bool, &queue_only_load_latch }, { "queue_only_override", opt_bool, &queue_only_override }, { "queue_run_in_order", opt_bool, &queue_run_in_order }, - { "queue_run_max", opt_int, &queue_run_max }, + { "queue_run_max", opt_stringptr, &queue_run_max }, { "queue_smtp_domains", opt_stringptr, &queue_smtp_domains }, { "receive_timeout", opt_time, &receive_timeout }, { "received_header_text", opt_stringptr, &received_header_text }, |