From: Alan T. DeKok Date: Mon, 7 Jan 2013 23:43:51 +0000 (-0500) Subject: Be more graceful about reporting home server state X-Git-Tag: release_3_0_0_beta1~1328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d29207bd76805fe7eea17fb2e89a0c84ea53cc37;p=thirdparty%2Ffreeradius-server.git Be more graceful about reporting home server state --- diff --git a/src/main/command.c b/src/main/command.c index 5f8d2e4e9f5..3fefc7f7a52 100644 --- a/src/main/command.c +++ b/src/main/command.c @@ -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;