Set a timer for marking a home server dead. Closes #712
authorAlan T. DeKok <aland@freeradius.org>
Thu, 26 Jun 2014 12:33:32 +0000 (08:33 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 26 Jun 2014 12:33:32 +0000 (08:33 -0400)
src/main/process.c

index 16345df..2a70e23 100644 (file)
@@ -3055,7 +3055,6 @@ static void ping_home_server(void *ctx)
        struct timeval when, now;
 
        if ((home->state == HOME_STATE_ALIVE) ||
-           (home->ping_check == HOME_PING_CHECK_NONE) ||
 #ifdef WITH_TCP
            (home->proto == IPPROTO_TCP) ||
 #endif
@@ -3065,6 +3064,9 @@ static void ping_home_server(void *ctx)
 
        gettimeofday(&now, NULL);
 
+       /*
+        *      We've run out of zombie time.  Mark it dead.
+        */
        if (home->state == HOME_STATE_ZOMBIE) {
                when = home->zombie_period_start;
                when.tv_sec += home->zombie_period;
@@ -3076,6 +3078,25 @@ static void ping_home_server(void *ctx)
                }
        }
 
+       /*
+        *      We're not supposed to be pinging it.  Just wake up
+        *      when we're supposed to mark it dead.
+        */
+       if (home->ping_check == HOME_PING_CHECK_NONE) {
+               if (home->state == HOME_STATE_ZOMBIE) {
+                       when = home->zombie_period_start;
+                       when.tv_sec += home->zombie_period;
+                       INSERT_EVENT(ping_home_server, home);
+               }
+
+               /*
+                *      Else mark_home_server_dead will set a timer
+                *      for revive_interval.
+                */
+               return;
+       }
+
+
        request = request_alloc(NULL);
        request->number = request_num_counter++;
        NO_CHILD_THREAD;