]> Pileus Git - ~andy/fetchmail/commitdiff
Support interface check in foreground as well as daemon mode.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 26 Dec 1996 18:56:47 +0000 (18:56 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 26 Dec 1996 18:56:47 +0000 (18:56 -0000)
svn path=/trunk/; revision=697

fetchmail.c
interface.c

index 61bafc4c2e699e01de94283e6a4c4184f7cfcd67..7952523d67a793b11be6afd0af55c045001d0658 100644 (file)
@@ -335,6 +335,13 @@ int main (int argc, char **argv)
      * reflect the status of that transaction.
      */
     do {
+#ifdef linux
+       if (poll_interval && monitor)
+           sleep(3);   /* allow some time for the link to quiesce */
+
+       interface_note_activity();
+#endif
+
        if (poll_interval)
        {
            if (outlevel == O_VERBOSE)
@@ -351,10 +358,6 @@ int main (int argc, char **argv)
             * We'll just assume setitimer(2) is available since fetchmail
             * has to have a BSDoid socket layer to work at all.
             */
-#ifdef linux
-           do {
-               interface_note_activity();
-#endif
            {
                struct itimerval ntimeout;
 
@@ -370,9 +373,6 @@ int main (int argc, char **argv)
                    (void) error(0, 0, "awakened by SIGUSR1");
                }
            }
-#ifdef linux
-           } while (!interface_approve());
-#endif
 
            if (outlevel == O_VERBOSE)
            {
@@ -383,6 +383,12 @@ int main (int argc, char **argv)
            }
        }
 
+
+#ifdef linux
+       if (!interface_approve())
+           continue;
+#endif
+
 #ifdef HAVE_RES_SEARCH
        sethostent(TRUE);       /* use TCP/IP for mailserver queries */
 #endif /* HAVE_RES_SEARCH */
index 39b399223e738315ec464a0baa30c6bf43ba5fa8..20d5e8ca5414440e8b5ec057a4177c09e447315a 100644 (file)
@@ -144,8 +144,6 @@ void interface_note_activity(void)
 {
        ifinfo_t ifinfo;
 
-       sleep(3);       /* allow some time for the link to quiesce */
-
        /* get the current I/O stats for the monitored link */
        if (monitor && get_ifinfo(monitor, &ifinfo))
                monitor_io = ifinfo.rx_packets + ifinfo.tx_packets;