]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add 15-second 'alive' messages (sent to server info channel) and support for a tempor...
authorMichael Graff <mgraff@isc.org>
Sun, 8 Sep 2002 18:34:04 +0000 (18:34 +0000)
committerMichael Graff <mgraff@isc.org>
Sun, 8 Sep 2002 18:34:04 +0000 (18:34 +0000)
bin/named/control.c
bin/named/include/named/control.h
bin/named/include/named/server.h
bin/named/server.c

index 5ff74b8d5d441d570f49451e445ac018d6f9122e..8c859ab578bb5c40fcb12310101a67fa149cf88c 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: control.c,v 1.13 2002/06/13 05:12:51 marka Exp $ */
+/* $Id: control.c,v 1.14 2002/09/08 18:34:03 explorer Exp $ */
 
 #include <config.h>
 
@@ -121,6 +121,9 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) {
                result = ns_server_freeze(ns_g_server, ISC_TRUE, command);
        } else if (command_compare(command, NS_COMMAND_UNFREEZE)) {
                result = ns_server_freeze(ns_g_server, ISC_FALSE, command);
+       } else if (command_compare(command, NS_COMMAND_TIMERPOKE)) {
+               result = ISC_R_SUCCESS;
+               isc_timermgr_poke(ns_g_timermgr);
        } else {
                isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
                              NS_LOGMODULE_CONTROL, ISC_LOG_WARNING,
index 1ec16c748ecd8f734605abd39e0c70ef8c58f363..2cb6eb10b11de1396423a3681aedd2e02d4ce032 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: control.h,v 1.10 2002/02/20 03:33:30 marka Exp $ */
+/* $Id: control.h,v 1.11 2002/09/08 18:34:04 explorer Exp $ */
 
 #ifndef NAMED_CONTROL_H
 #define NAMED_CONTROL_H 1
@@ -47,6 +47,7 @@
 #define NS_COMMAND_STATUS      "status"
 #define NS_COMMAND_FREEZE      "freeze"
 #define NS_COMMAND_UNFREEZE    "unfreeze"
+#define NS_COMMAND_TIMERPOKE   "timerpoke"
 
 isc_result_t
 ns_controls_create(ns_server_t *server, ns_controls_t **ctrlsp);
index 26c3480dd69557abff1f1a2d2e13425cf674aa0f..459043f02a32c4d02b4014ab5d9fa02928fc8181 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.h,v 1.66 2002/06/13 05:12:54 marka Exp $ */
+/* $Id: server.h,v 1.67 2002/09/08 18:34:04 explorer Exp $ */
 
 #ifndef NAMED_SERVER_H
 #define NAMED_SERVER_H 1
@@ -73,6 +73,7 @@ struct ns_server {
 
        isc_timer_t *           interface_timer;
        isc_timer_t *           heartbeat_timer;
+       isc_timer_t *           check_timer;
        isc_uint32_t            interface_interval;
        isc_uint32_t            heartbeat_interval;
 
index fe38b2f43ef8a2f03a1b5670d3d5e3cc9d0e46cd..6959209a178a1e276a9e4d11da0824069270523e 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.383 2002/08/30 02:05:29 marka Exp $ */
+/* $Id: server.c,v 1.384 2002/09/08 18:34:03 explorer Exp $ */
 
 #include <config.h>
 
@@ -1561,6 +1561,16 @@ heartbeat_timer_tick(isc_task_t *task, isc_event_t *event) {
        }
 }
 
+static void
+check_timer_tick(isc_task_t *task, isc_event_t *event) {
+       UNUSED(task);
+       isc_event_free(&event);
+
+       isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+                     NS_LOGMODULE_SERVER, ISC_LOG_INFO,
+                     "************ I'm still alive! **************");
+}
+
 /*
  * Replace the current value of '*field', a dynamically allocated
  * string or NULL, with a dynamically allocated copy of the
@@ -1902,6 +1912,17 @@ load_configuration(const char *filename, ns_server_t *server,
        }
        server->heartbeat_interval = heartbeat_interval;
 
+       /*
+        * Configure the dialup heartbeat timer.
+        */
+       {
+               isc_interval_t interval;
+               isc_interval_set(&interval, 15, 0);
+               CHECK(isc_timer_reset(server->check_timer,
+                                     isc_timertype_ticker,
+                                     NULL, &interval, ISC_FALSE));
+       }
+
        /*
         * Configure and freeze all explicit views.  Explicit
         * views that have zones were already created at parsing
@@ -2288,6 +2309,12 @@ run_server(isc_task_t *task, isc_event_t *event) {
                                    server, &server->heartbeat_timer),
                   "creating heartbeat timer");
 
+       CHECKFATAL(isc_timer_create(ns_g_timermgr, isc_timertype_inactive,
+                                   NULL, NULL, server->task,
+                                   check_timer_tick,
+                                   server, &server->check_timer),
+                  "creating check timer");
+
        CHECKFATAL(cfg_parser_create(ns_g_mctx, NULL, &ns_g_parser),
                   "creating default configuration parser");
 
@@ -2349,6 +2376,7 @@ shutdown_server(isc_task_t *task, isc_event_t *event) {
 
        isc_timer_detach(&server->interface_timer);
        isc_timer_detach(&server->heartbeat_timer);
+       isc_timer_detach(&server->check_timer);
 
        ns_interfacemgr_shutdown(server->interfacemgr);
        ns_interfacemgr_detach(&server->interfacemgr);
@@ -2436,6 +2464,7 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
 
        server->interface_timer = NULL;
        server->heartbeat_timer = NULL;
+       server->check_timer = NULL;
        
        server->interface_interval = 0;
        server->heartbeat_interval = 0;