From 7bae7c8ed3ae6420c749f04ab3cb716e00071389 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Thu, 26 Jun 2014 08:33:32 -0400 Subject: [PATCH] Set a timer for marking a home server dead. Closes #712 --- src/main/process.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/process.c b/src/main/process.c index 16345df..2a70e23 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -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; -- 2.1.4