From 879d6b039f7e1595e025e2204078d91dd5adcc76 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 3 May 2011 17:50:34 -0700 Subject: [PATCH] Revert "osd: simplify check for unconsumed events" This reverts commit ab34a3ce3e757a54816bd9b884c3f900361d4930. It turns out that unconsumed_event supersedes checking outer states. :( Signed-off-by: Samuel Just --- src/osd/PG.h | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/osd/PG.h b/src/osd/PG.h index e228ffe7f154e..01d08f1de9d4e 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -889,10 +889,6 @@ public: assert(state->rctx->notify_list); (*state->rctx->notify_list)[to].push_back(info); } - - void unconsumed_event(const boost::statechart::event_base& e) { - assert(0 == "unconsumed state machine event"); - } }; friend class RecoveryMachine; @@ -902,12 +898,25 @@ public: virtual ~NamedState() {} }; + struct Crashed : + boost::statechart::state< Crashed, RecoveryMachine >, NamedState { + const char *get_state_name() { return "Crashed"; } + Crashed(my_context ctx) : my_base(ctx) { assert(0); } + }; + struct Started; struct Initial : boost::statechart::simple_state< Initial, RecoveryMachine >, NamedState { const char *get_state_name() { return "Initial"; } typedef boost::mpl::list < - boost::statechart::transition< Initialize, Started > + boost::statechart::transition< Initialize, Started >, + boost::statechart::transition< MNotifyRec, Crashed >, + boost::statechart::transition< MInfoRec, Crashed >, + boost::statechart::transition< MLogRec, Crashed >, + boost::statechart::transition< MQuery, Crashed >, + boost::statechart::transition< Activate, Crashed >, + boost::statechart::transition< AdvMap, Crashed >, + boost::statechart::transition< ActMap, Crashed > > reactions; }; @@ -916,7 +925,13 @@ public: const char *get_state_name() { return "Reset"; } typedef boost::mpl::list < boost::statechart::custom_reaction< AdvMap >, - boost::statechart::custom_reaction< ActMap > + boost::statechart::custom_reaction< ActMap >, + boost::statechart::transition< MNotifyRec, Crashed >, + boost::statechart::transition< MInfoRec, Crashed >, + boost::statechart::transition< MLogRec, Crashed >, + boost::statechart::transition< MQuery, Crashed >, + boost::statechart::transition< Initialize, Crashed >, + boost::statechart::transition< Activate, Crashed > > reactions; boost::statechart::result react(const AdvMap&); boost::statechart::result react(const ActMap&); @@ -927,7 +942,14 @@ public: boost::statechart::simple_state< Started, RecoveryMachine, Start >, NamedState { const char *get_state_name() { return "Started"; } typedef boost::mpl::list < - boost::statechart::custom_reaction< AdvMap > + boost::statechart::custom_reaction< AdvMap >, + boost::statechart::transition< ActMap, Crashed >, + boost::statechart::transition< MNotifyRec, Crashed >, + boost::statechart::transition< MInfoRec, Crashed >, + boost::statechart::transition< MLogRec, Crashed >, + boost::statechart::transition< MQuery, Crashed >, + boost::statechart::transition< Initialize, Crashed >, + boost::statechart::transition< Activate, Crashed > > reactions; boost::statechart::result react(const AdvMap&); }; @@ -1003,6 +1025,7 @@ public: struct ReplicaActive : boost::statechart::state< ReplicaActive, Started >, NamedState { const char *get_state_name() { return "ReplicaActive"; } typedef boost::mpl::list < + boost::statechart::transition< MQuery, Crashed >, boost::statechart::custom_reaction< ActMap >, boost::statechart::custom_reaction< MInfoRec > > reactions; @@ -1042,7 +1065,9 @@ public: set peer_info_requested; typedef boost::mpl::list < boost::statechart::transition< GotInfo, GetLog >, - boost::statechart::custom_reaction< MNotifyRec > + boost::statechart::custom_reaction< MNotifyRec >, + boost::statechart::transition< MLogRec, Crashed >, + boost::statechart::transition< BacklogComplete, Crashed > > reactions; GetInfo(my_context ctx); -- 2.39.5