Skip to content

Commit

Permalink
Be more graceful about reporting home server state
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Jan 7, 2013
1 parent e61e676 commit d29207b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main/command.c
Expand Up @@ -642,7 +642,24 @@ static int command_show_home_servers(rad_listen_t *listener, UNUSED int argc, UN
state = "dead";

} else if (home->state == HOME_STATE_UNKNOWN) {
state = "unknown";
time_t now = time(NULL);

/*
* We've recently received a packet, so
* the home server seems to be alive.
*
* The *reported* state changes because
* the internal state machine NEEDS THE
* RIGHT STATE. However, reporting that
* to the admin will confuse him. So...
* we lie. Yes, that dress doesn't make
* you look fat.
*/
if ((home->last_packet_recv + home->ping_interval) >= now) {
state = "alive";
} else {
state = "unknown";
}

} else continue;

Expand Down

0 comments on commit d29207b

Please sign in to comment.