[23146] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r22807 - trunk/athena/lib/zephyr/zhm

daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Thu Apr 3 12:07:57 2008

Date: Thu, 3 Apr 2008 12:07:27 -0400 (EDT)
From: ghudson@MIT.EDU
Message-Id: <200804031607.MAA05536@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: ghudson
Date: 2008-04-03 12:07:26 -0400 (Thu, 03 Apr 2008)
New Revision: 22807

Modified:
   trunk/athena/lib/zephyr/zhm/zhm.8
   trunk/athena/lib/zephyr/zhm/zhm.c
Log:
Some zhm behavior changes from Karl Ramm:
  * Accept -N option to disable initial boot message.
  * Don't retry Hesiod resolution before daemonizing, so we don't
    hang the boot sequence.
  * Don't flush subs when exiting; let the server time them out.


Modified: trunk/athena/lib/zephyr/zhm/zhm.8
===================================================================
--- trunk/athena/lib/zephyr/zhm/zhm.8	2008-04-02 19:44:24 UTC (rev 22806)
+++ trunk/athena/lib/zephyr/zhm/zhm.8	2008-04-03 16:07:26 UTC (rev 22807)
@@ -70,6 +70,11 @@
 option disables the "flush" operation which allows any client to flush
 all subscriptions for the host.
 .PP
+The
+.I -N
+option disables the boot notice sent by zhm on startup, so that
+subscriptions for clients on the host are not flushed on the server.
+.PP
 The optional
 .I server
 arguments are used to replace the set of server names supplied by

Modified: trunk/athena/lib/zephyr/zhm/zhm.c
===================================================================
--- trunk/athena/lib/zephyr/zhm/zhm.c	2008-04-02 19:44:24 UTC (rev 22806)
+++ trunk/athena/lib/zephyr/zhm/zhm.c	2008-04-03 16:07:26 UTC (rev 22807)
@@ -27,6 +27,8 @@
 int hmdebug, rebootflag, noflushflag, errflg, dieflag, inetd, oldpid, nofork;
 int no_server = 1, nservchang, nserv, nclt;
 int booting = 1, timeout_type, deactivated = 1;
+int bootflag = 1;
+int started = 0;
 long starttime;
 u_short cli_port;
 struct sockaddr_in cli_sin, serv_sin, from;
@@ -76,7 +78,7 @@
 	exit(-1);
     }
     prim_serv[0] = '\0';
-    while ((opt = getopt(argc, argv, "drhinf")) != EOF)
+    while ((opt = getopt(argc, argv, "drhinfN")) != EOF)
 	switch(opt) {
 	  case 'd':
 	    hmdebug = 1;
@@ -101,6 +103,9 @@
 	  case 'f':
 	    noflushflag = 1;
 	    break;
+          case 'N':
+            bootflag = 0;
+            break;
 	  case '?':
 	  default:
 	    errflg++;
@@ -150,6 +155,7 @@
 	exit(ZERR_SERVNAK);
     }
     init_hm();
+    started = 1;
 
     DPR2("zephyr server port: %u\n", ntohs(serv_sin.sin_port));
     DPR2("zephyr client port: %u\n", ntohs(cli_port));
@@ -309,6 +315,8 @@
 	}
 	while ((serv_list = hes_resolve(zcluster, "sloc")) == (char **)NULL) {
 	    syslog(LOG_ERR, "No servers or no hesiod");
+	    if (!started)
+		return; /* do not hang forever*/
 	    /* wait a bit, and try again */
 	    sleep(30);
 	}
@@ -427,7 +435,10 @@
 	  memcpy(&serv_sin.sin_addr, hp->h_addr, 4);
      }
 
-     send_boot_notice(HM_BOOT);
+     if (bootflag)
+          send_boot_notice(HM_BOOT);
+     else
+          send_boot_notice(HM_ATTACH);
      deactivated = 0;
 
 #ifdef _POSIX_VERSION
@@ -600,7 +611,6 @@
 void die_gracefully()
 {
      syslog(LOG_INFO, "Terminate signal caught...");
-     send_flush_notice(HM_FLUSH);
      unlink(PidFile);
      closelog();
      exit(0);


home help back first fref pref prev next nref lref last post