summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNate Straz <nstraz@redhat.com>2006-09-06 21:26:56 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:46 -0400
commitac7a3387793b333f519940046a6f8d295c9d0596 (patch)
tree1dd0abbccf8ec645fbef593d0d82870f3c6722f8
parent896b73f8c47c2d9c8c607a9906db8f1474a66870 (diff)
downloadqarsh-ac7a3387793b333f519940046a6f8d295c9d0596.zip
qarsh-ac7a3387793b333f519940046a6f8d295c9d0596.tar.gz
qarsh-ac7a3387793b333f519940046a6f8d295c9d0596.tar.xz
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.
-rw-r--r--hbeat.c12
1 files changed, 11 insertions, 1 deletions
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) {