From 28522f8a6a17719f50393e36ac2d88fabcefa4fb Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 27 Mar 2009 07:26:27 -0400 Subject: [PATCH] Fix bug where services restarted by the monitor would be pinged more than once per cycle --- server/monitor/monitor.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 0ee344c..9320ed8 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -64,6 +64,8 @@ struct mt_svc { time_t last_pong; int debug_level; + + struct tevent_timer *ping_ev; }; struct mt_ctx { @@ -192,6 +194,11 @@ static void svc_try_restart(struct mt_svc *svc, time_t now) return; } + /* Shut down the current ping timer so it will restart + * cleanly in start_service() + */ + talloc_free(svc->ping_ev); + ret = start_service(svc); if (ret != EOK) { DEBUG(0,("Failed to restart service '%s'\n", svc->name)); @@ -286,6 +293,7 @@ static void set_tasks_checker(struct mt_svc *svc) svc->name)); /* FIXME: shutdown ? */ } + svc->ping_ev = te; } static void global_checks_handler(struct tevent_context *ev, -- 1.6.0.6