From f83db03bac37677815be96e964cc87ac0548eabf Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 4 Oct 2002 11:54:41 +0000 Subject: [PATCH] Remember down servers for some time. --- ChangeLog | 9 +++++++++ README | 4 ++-- debian/changelog | 6 ++++++ net.h | 5 +++-- nwho.c | 14 ++++++++++++-- nwho.lsm | 6 +++--- nwhod.c | 4 ++-- 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0b1a27..97dd283 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-10-04 Martin Mares + + * When a server stops responding, keep its record for a longer + time, but report the server as down. DEFAULT_DOWN_TIME and + DEFAULT_DEAD_TIME in net.h control the parameters. Requested + by Pavel Troller . + + * Released as version 1.11. + 2002-07-06 Martin Mares * Makefile: Split ywho and nwho. Released as version 1.10. diff --git a/README b/README index 50dc89e..0bb8ec7 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ -This package contains the Yet Another Network Who-like Utility, version 1.9. +This package contains the Yet Another Network Who-like Utility, version 1.11. -Copyright (c) 1996--2001 Martin Mares +Copyright (c) 1996--2002 Martin Mares All files in this package can be freely distributed and used according to the terms of the GNU General Public License, either version 2 or diff --git a/debian/changelog b/debian/changelog index 37f03e9..cfef44f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nwho (1.11) unstable; urgency=low + + * New upstream version. + + -- Martin Mares Fri, 4 Oct 2002 13:53:53 +0200 + nwho (1.10) unstable; urgency=low * New upstream version. diff --git a/net.h b/net.h index 4b6b713..7b65eca 100644 --- a/net.h +++ b/net.h @@ -1,7 +1,7 @@ /* * The Remote User Info Distribution Protocol * - * (c) 1997--2001 Martin Mares + * (c) 1997--2002 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU General Public License. See file COPYING in any of the GNU packages. @@ -34,4 +34,5 @@ struct rywho_pkt { #define DEFAULT_SEND_TIME 30 #define DEFAULT_PRUNE_TIME 30 -#define DEFAULT_DEAD_TIME 120 +#define DEFAULT_DOWN_TIME 120 +#define DEFAULT_DEAD_TIME 4*86400 diff --git a/nwho.c b/nwho.c index 505309c..3adb1ec 100644 --- a/nwho.c +++ b/nwho.c @@ -1,7 +1,7 @@ /* - * The Remote User Information Lister 1.9 + * The Remote User Information Lister * - * (c) 1997--2001 Martin Mares + * (c) 1997--2002 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU General Public License. See file COPYING in any of the GNU packages. @@ -13,12 +13,14 @@ #include #include #include +#include #include #include #include "net.h" static int is_uptime; +static time_t now; static void puttime(int s) @@ -51,6 +53,11 @@ show_uptime(char *name, struct rywho_pkt *p) { int i; + if (p->server_time - now >= DEFAULT_DOWN_TIME) + { + printf("%-16s down\n", name); + return; + } printf("%-16s up ", name); puttime(ntohl(p->uptime)); printf(" load"); @@ -69,6 +76,8 @@ show_users(char *name, struct rywho_pkt *p) int m = ntohl(p->num_users); struct userinfo *i; + if (p->server_time - now >= DEFAULT_DOWN_TIME) + return; for(u=0; uusers[u]; @@ -140,6 +149,7 @@ main(int argc, char **argv) } if (!is_uptime) puts("Name Li M Where LogT IdleT"); + now = time(NULL); scan(); return 0; } diff --git a/nwho.lsm b/nwho.lsm index f17fa73..a4b07c3 100644 --- a/nwho.lsm +++ b/nwho.lsm @@ -1,13 +1,13 @@ Begin3 Title: ywho -Version: 1.10 -Entered-date: 020705 +Version: 1.11 +Entered-date: 021004 Description: A rwhod replacement with central server, allowing user information to be gathered across routers. Keywords: rwho Author: Martin Mares Maintained-by: Martin Mares -Primary-site: atrey.karlin.mff.cuni.cz/pub/local/mj/linux/nwho-1.10.tar.gz +Primary-site: atrey.karlin.mff.cuni.cz/pub/local/mj/linux/nwho-1.11.tar.gz Alternate-site: metalab.unc.edu/pub/Linux/system/status Copying-policy: GPL End diff --git a/nwhod.c b/nwhod.c index d706fbf..e2747c2 100644 --- a/nwhod.c +++ b/nwhod.c @@ -1,7 +1,7 @@ /* - * The Remote User Information Daemon 1.9 + * The Remote User Information Daemon * - * (c) 1997--2001 Martin Mares + * (c) 1997--2002 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU General Public License. See file COPYING in any of the GNU packages. -- 2.39.5