]> mj.ucw.cz Git - nwho.git/commitdiff
Remember down servers for some time.
authorMartin Mares <mj@ucw.cz>
Fri, 4 Oct 2002 11:54:41 +0000 (11:54 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 4 Oct 2002 11:54:41 +0000 (11:54 +0000)
ChangeLog
README
debian/changelog
net.h
nwho.c
nwho.lsm
nwhod.c

index b0b1a27fd74a34d9a9604444e6cef771bc12f489..97dd2837dab62d810c822d6e00960b536ffecdb5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-10-04  Martin Mares  <mj@ucw.cz>
+
+       * 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 <patrol@sinus.cz>.
+
+       * Released as version 1.11.
+
 2002-07-06  Martin Mares  <mj@atrey.karlin.mff.cuni.cz>
 
        * Makefile: Split ywho and nwho. Released as version 1.10.
diff --git a/README b/README
index 50dc89e3524fba257782c16e90f2fb87b4ab0e55..0bb8ec7b85a6b9a97ac17094def50668f25c0ac2 100644 (file)
--- 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 <mj@atrey.karlin.mff.cuni.cz>
+Copyright (c) 1996--2002 Martin Mares <mj@ucw.cz>
 
 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
index 37f03e9cc0a3574c7bad5785bb5199158c7c3289..cfef44f51547686b022e07dbcbb7940199e05fda 100644 (file)
@@ -1,3 +1,9 @@
+nwho (1.11) unstable; urgency=low
+
+  * New upstream version.
+
+ -- Martin Mares <mj@ucw.cz>  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 4b6b7135cd2790c2464bc187da8af32b49851e2d..7b65eca11c096f32864d3057ce28d6dff6104a60 100644 (file)
--- a/net.h
+++ b/net.h
@@ -1,7 +1,7 @@
 /*
  *     The Remote User Info Distribution Protocol
  *
- *     (c) 1997--2001 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997--2002 Martin Mares <mj@ucw.cz>
  *
  *     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 505309c35ebc0b010353233af1b677a2277bdc8f..3adb1ec3b6dee1deed0e3026dbfc07c4effd2526 100644 (file)
--- 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 <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997--2002 Martin Mares <mj@ucw.cz>
  *
  *     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.
 #include <fcntl.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <time.h>
 #include <netinet/in.h>
 #include <asm/types.h>
 
 #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; u<m; u++)
     {
       i = &p->users[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;
 }
index f17fa7377fc31e86886c37a1c88b3b7685f2a09c..a4b07c34eb9b30fd631e7abd68e125a9cdbe7fa4 100644 (file)
--- 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 <mj@atrey.karlin.mff.cuni.cz>
 Maintained-by: Martin Mares <mj@atrey.karlin.mff.cuni.cz>
-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 d706fbf257cbc3a78b22e2904e0c5ac9be94aee3..e2747c2b7bc3cba14b77c4d696f99e54e2b5dcdc 100644 (file)
--- 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 <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997--2002 Martin Mares <mj@ucw.cz>
  *
  *     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.