diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1999-07-31 20:44:55 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1999-07-31 20:44:55 +0000 |
commit | 79739caa154403260496d3b0c33f47ef0cf21447 (patch) | |
tree | d416492fcb57138c30db613e2171946d2c6fff1c /interface.c | |
parent | 640a00628977de30f96e6c0fcc2289b28c3a8bac (diff) | |
download | fetchmail-79739caa154403260496d3b0c33f47ef0cf21447.tar.gz fetchmail-79739caa154403260496d3b0c33f47ef0cf21447.tar.bz2 fetchmail-79739caa154403260496d3b0c33f47ef0cf21447.zip |
Before applying Brian Boutel's lexer fix.
svn path=/trunk/; revision=2518
Diffstat (limited to 'interface.c')
-rw-r--r-- | interface.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/interface.c b/interface.c index d93b096d..d1295f51 100644 --- a/interface.c +++ b/interface.c @@ -43,6 +43,7 @@ #include "config.h" #include "fetchmail.h" #include "i18n.h" +#include "tunable.h" typedef struct { struct in_addr addr, dstaddr, netmask; @@ -58,6 +59,13 @@ static char *netdevfmt; #if defined(linux) +/* + * Count of packets to see on an interface before monitor considers it up. + * Needed because when pppd shuts down the link, the packet counts go up + * by two (one rx and one tx?, maybe). A value of 2 seems to do the trick. + */ +#define MONITOR_SLOP 2 + void interface_init(void) /* figure out which /proc/dev/net format to use */ { @@ -77,7 +85,7 @@ void interface_init(void) if (major >= 2 && minor >= 2) /* Linux 2.2 -- transmit packet count in 10th field */ - netdevfmt = "%d %d %*d %*d %*d %d %*d %*d %*d %*d %d %*d %d"; + netdevfmt = "%d %d %*d %*d %*d %d %*d %*d %*d %d %*d %*d %d"; } } @@ -461,8 +469,8 @@ int interface_approve(struct hostdata *hp) #endif /* if monitoring, check link for activity if it is up */ if (get_ifinfo(hp->monitor, &ifinfo) && - hp->monitor_io == ifinfo.rx_packets + - ifinfo.tx_packets) { + hp->monitor_io - (ifinfo.rx_packets + + ifinfo.tx_packets) >= -MONITOR_SLOP) { (void) report(stdout, _("skipping poll of %s, %s inactive\n"), hp->pollname, hp->monitor); @@ -470,7 +478,7 @@ int interface_approve(struct hostdata *hp) } #ifdef ACTIVITY_DEBUG - error(0, 0, _("activity on %s was %d, is %d"), + report(stdout _("activity on %s was %d, is %d"), hp->monitor, hp->monitor_io, ifinfo.rx_packets + ifinfo.tx_packets); #endif |