]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-20010721
authorWietse Venema <wietse@porcupine.org>
Sat, 21 Jul 2001 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:27:23 +0000 (06:27 +0000)
postfix/src/global/mail_version.h
postfix/src/master/mail_flow.c
postfix/src/nqmgr/qmgr.c
postfix/src/qmgr/qmgr.c

index b2a510397ab0fb38f2703a431cdb3eac673859e0..4ff54c15146325c496abd4d33e8fe4eed0fa8c73 100644 (file)
@@ -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
index 5fc129216bb547e359b22417aba6da9568812115..603a1f37327511a8eed403a6495cb1bd3bd63b1b 100644 (file)
@@ -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)
index c8c7f8685f5e81593a65a8e033f62f5674083721..c9f4618774fcc43a70482ad885444368b3f9581a 100644 (file)
@@ -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[] = {
index 0ce592ece79842914eac2b6e49865fa99e9859b9..1c48b118b94258138f32159127720ad6e7794708 100644 (file)
@@ -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[] = {