From 17c4a76f7e3c09ed67eb4bc3c2928d1be2b8781b Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Sat, 22 Jul 2017 14:05:32 +0800 Subject: [PATCH] mon/HealthMontior: guard propose_pending() process Which is for leader only. The current code logic has no problem but this is defensive and therefore should be considered as a fine cleanup. Signed-off-by: xie xingguo --- src/mon/HealthMonitor.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 9775344aa57..e9e5ad3aa4a 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -198,10 +198,11 @@ void HealthMonitor::tick() if (check_member_health()) { changed = true; } - if (mon->is_leader()) { - if (check_leader_health()) { - changed = true; - } + if (!mon->is_leader()) { + return; + } + if (check_leader_health()) { + changed = true; } if (changed) { propose_pending(); -- 2.47.3