From: Wietse Venema Date: Sat, 21 Jul 2001 05:00:00 +0000 (-0500) Subject: snapshot-20010721 X-Git-Tag: v1.1.0~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74572776d9b2346a0440446e5948d92d8488687d;p=thirdparty%2Fpostfix.git snapshot-20010721 --- diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index b2a510397..4ff54c151 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Snapshot-20010720" +#define DEF_MAIL_VERSION "Snapshot-20010721" extern char *var_mail_version; /* LICENSE diff --git a/postfix/src/master/mail_flow.c b/postfix/src/master/mail_flow.c index 5fc129216..603a1f373 100644 --- a/postfix/src/master/mail_flow.c +++ b/postfix/src/master/mail_flow.c @@ -100,10 +100,10 @@ int mail_flow_put(int len) msg_panic("%s: bad length %d", myname, len); /* - * Read and discard N bytes. + * Write or discard N bytes. */ for (count = len; count > 0; count -= n) - if ((n = read(MASTER_FLOW_READ, buf, count > BUFFER_SIZE ? + if ((n = write(MASTER_FLOW_WRITE, buf, count > BUFFER_SIZE ? BUFFER_SIZE : count)) < 0) return (-1); if (msg_verbose) diff --git a/postfix/src/nqmgr/qmgr.c b/postfix/src/nqmgr/qmgr.c index c8c7f8685..c9f461877 100644 --- a/postfix/src/nqmgr/qmgr.c +++ b/postfix/src/nqmgr/qmgr.c @@ -335,6 +335,7 @@ char *var_defer_xports; bool var_allow_min_user; int var_local_con_lim; int var_local_rcpt_lim; +int var_proc_limit; static QMGR_SCAN *qmgr_incoming; static QMGR_SCAN *qmgr_deferred; @@ -420,6 +421,7 @@ static int qmgr_loop(char *unused_name, char **unused_argv) { char *in_path = 0; char *df_path = 0; +int token_count; /* * This routine runs as part of the event handling loop, after the event @@ -455,10 +457,12 @@ static int qmgr_loop(char *unused_name, char **unused_argv) * get ahead of the queue manager, but don't block them completely. */ if (var_glob_flow_ctl) { - if (in_path) - mail_flow_put(1); - else - mail_flow_get(1000); + if (in_path != 0) + mail_flow_put(1); + else if ((token_count = peekfd(MASTER_FLOW_READ)) < var_proc_limit) + mail_flow_put(var_proc_limit - token_count); + else if (token_count > var_proc_limit) + mail_flow_get(token_count - var_proc_limit); } if (in_path || df_path) return (DONT_WAIT); @@ -546,6 +550,7 @@ int main(int argc, char **argv) VAR_DEST_RCPT_LIMIT, DEF_DEST_RCPT_LIMIT, &var_dest_rcpt_limit, 0, 0, VAR_LOCAL_RCPT_LIMIT, DEF_LOCAL_RCPT_LIMIT, &var_local_rcpt_lim, 0, 0, VAR_LOCAL_CON_LIMIT, DEF_LOCAL_CON_LIMIT, &var_local_con_lim, 0, 0, + VAR_PROC_LIMIT, DEF_PROC_LIMIT, &var_proc_limit, 1, 0, 0, }; static CONFIG_BOOL_TABLE bool_table[] = { diff --git a/postfix/src/qmgr/qmgr.c b/postfix/src/qmgr/qmgr.c index 0ce592ece..1c48b118b 100644 --- a/postfix/src/qmgr/qmgr.c +++ b/postfix/src/qmgr/qmgr.c @@ -294,6 +294,7 @@ int var_qmgr_fudge; int var_qmgr_hog; int var_local_rcpt_lim; /* XXX */ int var_local_con_lim; /* XXX */ +int var_proc_limit; static QMGR_SCAN *qmgr_incoming; static QMGR_SCAN *qmgr_deferred; @@ -379,6 +380,7 @@ static int qmgr_loop(char *unused_name, char **unused_argv) { char *in_path = 0; char *df_path = 0; + int token_count; /* * This routine runs as part of the event handling loop, after the event @@ -417,10 +419,12 @@ static int qmgr_loop(char *unused_name, char **unused_argv) * get ahead of the queue manager, but don't block them completely. */ if (var_glob_flow_ctl) { - if (in_path) + if (in_path != 0) mail_flow_put(1); - else - mail_flow_get(1000); + else if ((token_count = peekfd(MASTER_FLOW_READ)) < var_proc_limit) + mail_flow_put(var_proc_limit - token_count); + else if (token_count > var_proc_limit) + mail_flow_get(token_count - var_proc_limit); } if (in_path || df_path) return (DONT_WAIT); @@ -503,6 +507,7 @@ int main(int argc, char **argv) VAR_QMGR_HOG, DEF_QMGR_HOG, &var_qmgr_hog, 10, 100, VAR_LOCAL_RCPT_LIMIT, DEF_LOCAL_RCPT_LIMIT, &var_local_rcpt_lim, 0, 0, VAR_LOCAL_CON_LIMIT, DEF_LOCAL_CON_LIMIT, &var_local_con_lim, 0, 0, + VAR_PROC_LIMIT, DEF_PROC_LIMIT, &var_proc_limit, 1, 0, 0, }; static CONFIG_BOOL_TABLE bool_table[] = {