]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blobdiff - zephyr/zhm/zhm_server.c
Import new release
[1ts-debian.git] / zephyr / zhm / zhm_server.c
index 81dea0ef2b31204526a58b13619737b49885fc42..cd460c89ce85d9b361a21217f9e9927c8183d17f 100644 (file)
@@ -3,7 +3,7 @@
  *
  *      Created by:     David C. Jedlinsky
  *
- *      $Id: zhm_server.c,v 1.17 1999/10/14 18:37:35 ghudson Exp $
+ *      $Id: zhm_server.c,v 1.18 2000/05/08 16:00:08 ghudson Exp $
  *
  *      Copyright (c) 1987 by the Massachusetts Institute of Technology.
  *      For copying and distribution information, see the file
 
 #ifndef lint
 #ifndef SABER
-static char rcsid_hm_server_c[] = "$Id: zhm_server.c,v 1.17 1999/10/14 18:37:35 ghudson Exp $";
+static char rcsid_hm_server_c[] = "$Id: zhm_server.c,v 1.18 2000/05/08 16:00:08 ghudson Exp $";
 #endif /* SABER */
 #endif /* lint */
 
 static void boot_timeout __P((void *));
+static int get_serv_timeout __P((void));
 
 static Timer *boot_timer = NULL;
+static int serv_rexmit_times[] = { 5, 10, 20, 40 };
+static int serv_timeouts = 0;
 
 int serv_loop = 0;
 extern u_short cli_port;
@@ -64,7 +67,7 @@ char *op;
          Zperr(ret);
          com_err("hm", ret, "sending startup notice");
      }
-     boot_timer = timer_set_rel(SERV_TIMEOUT, boot_timeout, NULL);
+     boot_timer = timer_set_rel(get_serv_timeout(), boot_timeout, NULL);
 }
 
 /* Argument is whether we are detaching or really going down */
@@ -182,6 +185,7 @@ ZNotice_t *notice;
     } else {
        /* This is our server, handle the notice */
        booting = 0;
+       serv_timeouts = 0;
        if (boot_timer) {
            timer_reset(boot_timer);
            boot_timer = NULL;
@@ -305,6 +309,17 @@ char *sugg_serv;
 static void boot_timeout(arg)
 void *arg;
 {
+    serv_timeouts++;
     new_server(NULL);
 }
 
+static int get_serv_timeout(void)
+{
+    int ind, ntimeouts;
+
+    ind = (numserv == 0) ? serv_timeouts : serv_timeouts / numserv;
+    ntimeouts = sizeof(serv_rexmit_times) / sizeof(*serv_rexmit_times);
+    if (ind >= ntimeouts)
+       ind = ntimeouts - 1;
+    return serv_rexmit_times[ind];
+}