summaryrefslogtreecommitdiff
path: root/zhm/zhm.c
diff options
context:
space:
mode:
authorGravatar David C. Jedlinsky <opus@mit.edu>1987-07-09 13:37:38 +0000
committerGravatar David C. Jedlinsky <opus@mit.edu>1987-07-09 13:37:38 +0000
commiteb457f2f6720a5336d2931798f452810c2b156ed (patch)
tree694aa81bc601dace5808390a44fedc47e9bb67c7 /zhm/zhm.c
parentb3af4f43e493cb6a37b6fa01f4829e6c15aaa89a (diff)
Modified boot and flush notices to handle HM_ATTACH and HM_DETACH.
Diffstat (limited to 'zhm/zhm.c')
-rw-r--r--zhm/zhm.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/zhm/zhm.c b/zhm/zhm.c
index ee3c9b1..372da7f 100644
--- a/zhm/zhm.c
+++ b/zhm/zhm.c
@@ -183,7 +183,7 @@ void init_hm()
bcopy(hp->h_addr, &serv_sin.sin_addr, hp->h_length);
}
- send_boot_notice();
+ send_boot_notice(HM_BOOT);
(void)signal (SIGALRM, handle_timeout);
(void)signal (SIGTERM, die_gracefully);
@@ -199,7 +199,10 @@ char *upcase(s)
return(r);
}
-send_boot_notice()
+/* Argument is whether we are actually booting, or just attaching
+ after a server switch */
+send_boot_notice(op)
+ char *op;
{
ZNotice_t notice;
Code_t ret;
@@ -209,7 +212,7 @@ send_boot_notice()
notice.z_port = cli_port;
notice.z_class = ZEPHYR_CTL_CLASS;
notice.z_class_inst = ZEPHYR_CTL_HM;
- notice.z_opcode = HM_BOOT;
+ notice.z_opcode = op;
notice.z_sender = "sender";
notice.z_recipient = "";
notice.z_message_len = 0;
@@ -227,7 +230,9 @@ send_boot_notice()
(void)alarm(SERV_TIMEOUT);
}
-send_flush_notice()
+/* Argument is whether we are detaching or really going down */
+send_flush_notice(op)
+ char *op;
{
ZNotice_t notice;
Code_t ret;
@@ -237,12 +242,12 @@ send_flush_notice()
notice.z_port = cli_port;
notice.z_class = ZEPHYR_CTL_CLASS;
notice.z_class_inst = ZEPHYR_CTL_HM;
- notice.z_opcode = HM_FLUSH;
+ notice.z_opcode = op;
notice.z_sender = "sender";
notice.z_recipient = "";
notice.z_message_len = 0;
- /* Tell server to look the other way */
+ /* Tell server to lose us */
if ((ret = ZSetDestAddr(&serv_sin)) != ZERR_NONE) {
Zperr(ret);
com_err("hm", ret, "setting destination");
@@ -434,9 +439,9 @@ new_server()
no_server = 1;
syslog (LOG_INFO, "Server went down, finding new server.");
- send_flush_notice();
+ send_flush_notice(HM_DETACH);
find_next_server();
- send_boot_notice();
+ send_boot_notice(HM_ATTACH);
}
void handle_timeout()
@@ -458,7 +463,7 @@ void handle_timeout()
void die_gracefully()
{
syslog(LOG_INFO, "Terminate signal caught...");
- send_flush_notice();
+ send_flush_notice(HM_FLUSH);
closelog();
exit(0);
}