diff -urN ../exim-4.84.orig/src/daemon.c ./src/daemon.c --- ../exim-4.84.orig/src/daemon.c 2014-08-09 15:44:29.000000000 +0300 +++ ./src/daemon.c 2014-09-23 17:26:09.000000000 +0300 @@ -562,9 +562,38 @@ whether we have received too many messages in this session for immediate delivery. */ + +int accept_queue_per_connection = -1; +if (smtp_accept_queue_per_connection != NULL) + { + uschar *expanded = expand_string(smtp_accept_queue_per_connection); + if (expanded == NULL) + { + if (!expand_string_forcedfail) + log_write(0, LOG_MAIN|LOG_PANIC, "expansion of smtp_accept_queue_per_connection " + "failed for message from %s: %s", sender_fullhost, expand_string_message); + } + /* For speed, interpret a decimal number inline here */ + else + { + accept_queue_per_connection = 0; + uschar *s = expanded; + while (isdigit(*s)) + accept_queue_per_connection = accept_queue_per_connection * 10 + *s++ - '0'; + if (*s != 0) + log_write(0, LOG_MAIN|LOG_PANIC, "expansion of smtp_accept_queue_per_connection " + "for message from %s contains non-digit: %s", sender_fullhost, expanded); + } + } +if (accept_queue_per_connection == -1) accept_queue_per_connection = 10; + + +// if (!session_local_queue_only && +// smtp_accept_queue_per_connection > 0 && +// receive_messagecount > smtp_accept_queue_per_connection) if (!session_local_queue_only && - smtp_accept_queue_per_connection > 0 && - receive_messagecount > smtp_accept_queue_per_connection) + accept_queue_per_connection > 0 && + receive_messagecount > accept_queue_per_connection) { session_local_queue_only = TRUE; queue_only_reason = 2; @@ -604,9 +633,12 @@ break; case 2: +// log_write(L_delay_delivery, +// LOG_MAIN, "no immediate delivery: more than %d messages " +// "received in one connection", smtp_accept_queue_per_connection); log_write(L_delay_delivery, LOG_MAIN, "no immediate delivery: more than %d messages " - "received in one connection", smtp_accept_queue_per_connection); + "received in one connection", accept_queue_per_connection); break; case 3: diff -urN ../exim-4.84.orig/src/exim.c ./src/exim.c --- ../exim-4.84.orig/src/exim.c 2014-09-23 02:01:26.000000000 +0300 +++ ./src/exim.c 2014-09-23 17:19:24.000000000 +0300 @@ -5484,9 +5484,38 @@ will be TRUE. If it is not, check on the number of messages received in this connection. */ + +int accept_queue_per_connection = -1; +if (smtp_accept_queue_per_connection != NULL) + { + uschar *expanded = expand_string(smtp_accept_queue_per_connection); + if (expanded == NULL) + { + if (!expand_string_forcedfail) + log_write(0, LOG_MAIN|LOG_PANIC, "expansion of smtp_accept_queue_per_connection " + "failed for message from %s: %s", sender_fullhost, expand_string_message); + } + /* For speed, interpret a decimal number inline here */ + else + { + accept_queue_per_connection = 0; + uschar *s = expanded; + while (isdigit(*s)) + accept_queue_per_connection = accept_queue_per_connection * 10 + *s++ - '0'; + if (*s != 0) + log_write(0, LOG_MAIN|LOG_PANIC, "expansion of smtp_accept_queue_per_connection " + "for message from %s contains non-digit: %s", sender_fullhost, expanded); + } + } +if (accept_queue_per_connection == -1) accept_queue_per_connection = 10; + + +// if (!session_local_queue_only && +// smtp_accept_queue_per_connection > 0 && +// receive_messagecount > smtp_accept_queue_per_connection) if (!session_local_queue_only && - smtp_accept_queue_per_connection > 0 && - receive_messagecount > smtp_accept_queue_per_connection) + accept_queue_per_connection > 0 && + receive_messagecount > accept_queue_per_connection) { session_local_queue_only = TRUE; queue_only_reason = 2; @@ -5526,9 +5555,12 @@ if (local_queue_only) switch(queue_only_reason) { case 2: +// log_write(L_delay_delivery, +// LOG_MAIN, "no immediate delivery: more than %d messages " +// "received in one connection", smtp_accept_queue_per_connection); log_write(L_delay_delivery, LOG_MAIN, "no immediate delivery: more than %d messages " - "received in one connection", smtp_accept_queue_per_connection); + "received in one connection", accept_queue_per_connection); break; case 3: diff -urN ../exim-4.84.orig/src/globals.c ./src/globals.c --- ../exim-4.84.orig/src/globals.c 2014-08-29 21:03:53.000000000 +0300 +++ ./src/globals.c 2014-09-23 02:03:29.000000000 +0300 @@ -1207,7 +1207,8 @@ int smtp_accept_max_per_connection = 1000; uschar *smtp_accept_max_per_host = NULL; int smtp_accept_queue = 0; -int smtp_accept_queue_per_connection = 10; +//int smtp_accept_queue_per_connection = 10; +uschar *smtp_accept_queue_per_connection = NULL; int smtp_accept_reserve = 0; uschar *smtp_active_hostname = NULL; BOOL smtp_authenticated = FALSE; diff -urN ../exim-4.84.orig/src/globals.h ./src/globals.h --- ../exim-4.84.orig/src/globals.h 2014-08-09 15:44:29.000000000 +0300 +++ ./src/globals.h 2014-09-23 02:04:18.000000000 +0300 @@ -757,7 +757,8 @@ extern int smtp_accept_max_per_connection; /* Max msgs per connection */ extern uschar *smtp_accept_max_per_host; /* Max SMTP cons from one IP addr */ extern int smtp_accept_queue; /* Queue after so many connections */ -extern int smtp_accept_queue_per_connection; /* Queue after so many msgs */ +//extern int smtp_accept_queue_per_connection; /* Queue after so many msgs */ +extern uschar *smtp_accept_queue_per_connection; /* Queue after so many msgs */ extern int smtp_accept_reserve; /* Reserve these SMTP connections */ extern uschar *smtp_active_hostname; /* Hostname for this message */ extern BOOL smtp_authenticated; /* Sending client has authenticated */ diff -urN ../exim-4.84.orig/src/readconf.c ./src/readconf.c --- ../exim-4.84.orig/src/readconf.c 2014-08-09 15:44:29.000000000 +0300 +++ ./src/readconf.c 2014-10-02 18:52:46.000000000 +0300 @@ -376,7 +376,7 @@ { "smtp_accept_max_per_connection", opt_int, &smtp_accept_max_per_connection }, { "smtp_accept_max_per_host", opt_stringptr, &smtp_accept_max_per_host }, { "smtp_accept_queue", opt_int, &smtp_accept_queue }, - { "smtp_accept_queue_per_connection", opt_int, &smtp_accept_queue_per_connection }, + { "smtp_accept_queue_per_connection", opt_stringptr, &smtp_accept_queue_per_connection }, { "smtp_accept_reserve", opt_int, &smtp_accept_reserve }, { "smtp_active_hostname", opt_stringptr, &raw_active_hostname }, { "smtp_banner", opt_stringptr, &smtp_banner },