From 18cf302377aa7a09ad4922c07c64fefc047f2bdb Mon Sep 17 00:00:00 2001 From: Michal Jarzabek Date: Sun, 24 Jul 2016 10:51:54 +0100 Subject: [PATCH] mon/Elector:move C_ElectionExpire class to cc file Signed-off-by: Michal Jarzabek (cherry picked from commit c819596e59fd5f66b3258fedd1d10b20cf70f0a9) --- src/mon/Elector.cc | 21 +++++++++++++++++++++ src/mon/Elector.h | 29 ----------------------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc index 9e011e34fdd..b670929f8ce 100644 --- a/src/mon/Elector.cc +++ b/src/mon/Elector.cc @@ -127,6 +127,27 @@ void Elector::defer(int who) void Elector::reset_timer(double plus) { + /** + * This class is used as the callback when the expire_event timer fires up. + * + * If the expire_event is fired, then it means that we had an election going, + * either started by us or by some other participant, but it took too long, + * thus expiring. + * + * When the election expires, we will check if we were the ones who won, and + * if so we will declare victory. If that is not the case, then we assume + * that the one we defered to didn't declare victory quickly enough (in fact, + * as far as we know, we may even be dead); so, just propose ourselves as the + * Leader. + */ + class C_ElectionExpire : public Context { + Elector *elector; + public: + explicit C_ElectionExpire(Elector *e) : elector(e) { } + void finish(int r) { + elector->expire(); + } + }; // set the timer cancel_timer(); expire_event = new C_ElectionExpire(this); diff --git a/src/mon/Elector.h b/src/mon/Elector.h index 03a9d17d9b2..849ec61461a 100644 --- a/src/mon/Elector.h +++ b/src/mon/Elector.h @@ -149,35 +149,6 @@ class Elector { */ void bump_epoch(epoch_t e); - /** - * @defgroup Elector_h_callbacks Callbacks - * @{ - */ - /** - * This class is used as the callback when the expire_event timer fires up. - * - * If the expire_event is fired, then it means that we had an election going, - * either started by us or by some other participant, but it took too long, - * thus expiring. - * - * When the election expires, we will check if we were the ones who won, and - * if so we will declare victory. If that is not the case, then we assume - * that the one we defered to didn't declare victory quickly enough (in fact, - * as far as we know, we may even be dead); so, just propose ourselves as the - * Leader. - */ - class C_ElectionExpire : public Context { - Elector *elector; - public: - explicit C_ElectionExpire(Elector *e) : elector(e) { } - void finish(int r) { - elector->expire(); - } - }; - /** - * @} - */ - /** * Start new elections by proposing ourselves as the new Leader. * -- 2.47.3