diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc index 4997d2fedeeab..6c57fdf11f80c 100644 --- a/src/mon/Elector.cc +++ b/src/mon/Elector.cc @@ -114,7 +114,7 @@ void Elector::_bump_epoch() void Elector::start() { - if (!participating) { + if (!logic.participating) { dout(0) << "not starting new election -- not participating" << dendl; return; } @@ -536,7 +536,7 @@ void Elector::dispatch(MonOpRequestRef op) case MSG_MON_ELECTION: { - if (!participating) { + if (!logic.participating) { return; } if (op->get_req()->get_source().num() >= mon->monmap->size()) { @@ -617,7 +617,5 @@ void Elector::dispatch(MonOpRequestRef op) void Elector::start_participating() { - if (!participating) { - participating = true; - } + logic.participating = true; } diff --git a/src/mon/Elector.h b/src/mon/Elector.h index 9820576a4f19f..85dadbfaa843e 100644 --- a/src/mon/Elector.h +++ b/src/mon/Elector.h @@ -31,11 +31,12 @@ class ElectionLogic { public: Elector *elector; epoch_t epoch; + bool participating; bool electing_me; set acked_me; int leader_acked; - ElectionLogic(Elector *e) : elector(e), epoch(0), + ElectionLogic(Elector *e) : elector(e), epoch(0), participating(true), electing_me(false), leader_acked(-1) {} void init(); void bump_epoch(epoch_t e); @@ -139,7 +140,7 @@ class Elector { * have to call Elector::start_participating for us to resume * participating in the quorum. */ - bool participating; + // bool participating; // electing me /** @@ -363,8 +364,7 @@ class Elector { */ explicit Elector(Monitor *m) : logic(this), elector(this), - mon(m), - participating(true) {} + mon(m) {} /** * Initiate the Elector class. @@ -426,7 +426,7 @@ class Elector { * * @post @p participating is false */ - void stop_participating() { participating = false; } + void stop_participating() { logic.participating = false; } /** * Start participating in Elections. *