diff options
Diffstat (limited to 'src/mon/QuorumService.h')
-rw-r--r-- | src/mon/QuorumService.h | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/mon/QuorumService.h b/src/mon/QuorumService.h index f1100520a0d..b354c40a77f 100644 --- a/src/mon/QuorumService.h +++ b/src/mon/QuorumService.h @@ -25,19 +25,9 @@ class QuorumService { - Context *tick_event; + Context *tick_event = nullptr; double tick_period; - struct C_Tick : public Context { - QuorumService *s; - C_Tick(QuorumService *qs) : s(qs) { } - void finish(int r) override { - if (r < 0) - return; - s->tick(); - } - }; - public: enum { SERVICE_HEALTH = 0x01, @@ -50,7 +40,6 @@ protected: epoch_t epoch; QuorumService(Monitor *m) : - tick_event(NULL), tick_period(g_conf->mon_tick_interval), mon(m), epoch(0) @@ -70,7 +59,11 @@ protected: if (tick_period <= 0) return; - tick_event = new C_Tick(this); + tick_event = new C_MonContext(mon, [this](int r) { + if (r < 0) + return; + tick(); + }); mon->timer.add_event_after(tick_period, tick_event); } |