From ac7a3387793b333f519940046a6f8d295c9d0596 Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Wed, 6 Sep 2006 21:26:56 +0000 Subject: Add a check when the btime changes to make sure we're getting consistent btime values. If we get a different value right way, toss them both and use the next one. --- hbeat.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hbeat.c b/hbeat.c index 902fe22..c51d159 100644 --- a/hbeat.c +++ b/hbeat.c @@ -86,7 +86,7 @@ unsigned int hbeat(hbeat_t hbh) { struct hbeat_s *hbeatp = hbh; - unsigned int hbeat; + unsigned int hbeat, hbeat2; time_t current_time; int retval; @@ -97,6 +97,16 @@ hbeat(hbeat_t hbh) } hbeat = btime(hbeatp->host); + /* quickly sanity check that we're getting the same + * hbeat every time we ask for it + */ + if (hbeatp->last_rhost_btime && hbeat != hbeatp->last_rhost_btime) { + hbeat2 = btime(hbeatp->host); + if (hbeat != hbeat2) { + fprintf(stderr, "Got conflicting hbeat times (%d and %d), discarding both\n", hbeat, hbeat2); + hbeat = btime(hbeatp->host); + } + } current_time = time(NULL); if (hbeat) { switch(hbeatp->rhost_state) { -- cgit