k option specifies checkpoint interval (default 10);
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 13 Mar 1991 09:31:30 +0000 (01:31 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 13 Mar 1991 09:31:30 +0000 (01:31 -0800)
qf file is rewritten after k successful deliveries.
(ref bug 4.3BSD-reno/usr.bin/10)

SCCS-vsn: usr.sbin/sendmail/src/conf.c 5.28
SCCS-vsn: usr.sbin/sendmail/src/queue.c 5.32
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 5.40
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 5.22
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 5.17
SCCS-vsn: usr.sbin/sendmail/src/version.c 5.66

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/version.c

index 1c8c7b9..618a77f 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     5.27 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     5.28 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/ioctl.h>
 #endif /* not lint */
 
 # include <sys/ioctl.h>
@@ -144,6 +144,7 @@ setdefaults()
        FileMode = 0644;
        DefUid = 1;
        DefGid = 1;
        FileMode = 0644;
        DefUid = 1;
        DefGid = 1;
+       CheckpointInterval = 10;
        setdefuser();
 }
 
        setdefuser();
 }
 
index b76402e..3de5d90 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  5.39 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  5.40 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -295,6 +295,8 @@ deliver(e, firstto)
                        {
                                rcode = mailfile(user, getctladdr(to));
                                giveresponse(rcode, m, e);
                        {
                                rcode = mailfile(user, getctladdr(to));
                                giveresponse(rcode, m, e);
+                               if (rcode == EX_OK)
+                                       to->q_flags |= QSENT;
                                continue;
                        }
                }
                                continue;
                        }
                }
@@ -438,9 +440,11 @@ deliver(e, firstto)
 
        if (tobuf[0] != '\0')
                giveresponse(rcode, m, e);
 
        if (tobuf[0] != '\0')
                giveresponse(rcode, m, e);
-       if (rcode != EX_OK)
-               for (to = tochain; to != NULL; to = to->q_tchain)
+       for (to = tochain; to != NULL; to = to->q_tchain)
+               if (rcode != EX_OK)
                        markfailure(e, to, rcode);
                        markfailure(e, to, rcode);
+               else
+                       to->q_flags |= QSENT;
 
        errno = 0;
        define('g', (char *) NULL, e);
 
        errno = 0;
        define('g', (char *) NULL, e);
@@ -1338,6 +1342,7 @@ sendall(e, mode)
        register ADDRESS *q;
        bool oldverbose;
        int pid;
        register ADDRESS *q;
        bool oldverbose;
        int pid;
+       int nsent;
        FILE *lockfp = NULL, *queueup();
 
        /* determine actual delivery mode */
        FILE *lockfp = NULL, *queueup();
 
        /* determine actual delivery mode */
@@ -1431,6 +1436,7 @@ sendall(e, mode)
        **  Run through the list and send everything.
        */
 
        **  Run through the list and send everything.
        */
 
+       nsent = 0;
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
                if (mode == SM_VERIFY)
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
                if (mode == SM_VERIFY)
@@ -1439,8 +1445,20 @@ sendall(e, mode)
                        if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
                                message(Arpa_Info, "deliverable");
                }
                        if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
                                message(Arpa_Info, "deliverable");
                }
-               else
-                       (void) deliver(e, q);
+               else if (!bitset(QDONTSEND, q->q_flags))
+               {
+                       /*
+                       **  Checkpoint the send list every few addresses
+                       */
+
+                       if (nsent >= CheckpointInterval)
+                       {
+                               queueup(e, TRUE, FALSE);
+                               nsent = 0;
+                       }
+                       if (deliver(e, q) == EX_OK)
+                               nsent++;
+               }
        }
        Verbose = oldverbose;
 
        }
        Verbose = oldverbose;
 
index abfde1c..f7e7fa2 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef QUEUE
 
 #ifndef lint
 #ifdef QUEUE
-static char sccsid[] = "@(#)queue.c    5.31 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c    5.32 (Berkeley) %G% (with queueing)";
 #else
 #else
-static char sccsid[] = "@(#)queue.c    5.31 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c    5.32 (Berkeley) %G% (without queueing)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -147,7 +147,7 @@ queueup(e, queueall, announce)
        /* output list of recipient addresses */
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
        /* output list of recipient addresses */
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
-               if (queueall ? !bitset(QDONTSEND, q->q_flags) :
+               if (queueall ? !bitset(QDONTSEND|QSENT, q->q_flags) :
                               bitset(QQUEUEUP, q->q_flags))
                {
                        char *ctluser, *getctluser();
                               bitset(QQUEUEUP, q->q_flags))
                {
                        char *ctluser, *getctluser();
index 7e2789c..2355bdc 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)readcf.c   5.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)readcf.c   5.22 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -763,6 +763,10 @@ setoption(opt, val, sticky)
                IgnrDot = atobool(val);
                break;
 
                IgnrDot = atobool(val);
                break;
 
+         case 'k':             /* checkpoint every N addresses */
+               CheckpointInterval = atoi(val);
+               break;
+
          case 'L':             /* log level */
                LogLevel = atoi(val);
                break;
          case 'L':             /* log level */
                LogLevel = atoi(val);
                break;
index 7c836f3..83c7421 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sendmail.h  5.16 (Berkeley) %G%
+ *     @(#)sendmail.h  5.17 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -15,7 +15,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 5.16            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 5.17            %G%";
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
@@ -113,6 +113,7 @@ typedef struct address ADDRESS;
 # define QGOODUID      000004  /* the q_uid q_gid fields are good */
 # define QPRIMARY      000010  /* set from argv */
 # define QQUEUEUP      000020  /* queue for later transmission */
 # define QGOODUID      000004  /* the q_uid q_gid fields are good */
 # define QPRIMARY      000010  /* set from argv */
 # define QQUEUEUP      000020  /* queue for later transmission */
+# define QSENT         000040  /* has been successfully delivered */
 # define QPSEUDO       000040  /* only on the list for verification */
 \f/*
 **  Mailer definition structure.
 # define QPSEUDO       000040  /* only on the list for verification */
 \f/*
 **  Mailer definition structure.
@@ -550,6 +551,7 @@ EXTERN char *PostMasterCopy;        /* address to get errs cc's */
 EXTERN char    *MxHosts[MAXMXHOSTS+1]; /* for MX RRs */
 EXTERN char    *TrustedUsers[MAXTRUST+1];      /* list of trusted users */
 EXTERN char    *UserEnviron[MAXUSERENVIRON+1]; /* saved user environment */
 EXTERN char    *MxHosts[MAXMXHOSTS+1]; /* for MX RRs */
 EXTERN char    *TrustedUsers[MAXTRUST+1];      /* list of trusted users */
 EXTERN char    *UserEnviron[MAXUSERENVIRON+1]; /* saved user environment */
+EXTERN int     CheckpointInterval;     /* queue file checkpoint interval */
 \f/*
 **  Trace information
 */
 \f/*
 **  Trace information
 */
index ddbb159..63652b4 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)version.c  5.65 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c  5.66 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-char   Version[] = "5.65";
+char   Version[] = "5.66";