From: Martin Willi Date: Tue, 19 Mar 2013 14:17:41 +0000 (+0100) Subject: Fix scheduling of heartbeat sending in HA plugin X-Git-Tag: 5.0.3rc1~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2071dd63d6812392a4b939cd592826e94aaf5341;p=thirdparty%2Fstrongswan.git Fix scheduling of heartbeat sending in HA plugin e0efd7c1 switches to automated job rescheduling for HA heartbeat. However, send_status() is initially called directly, which will not reschedule the job as required. --- diff --git a/src/libcharon/plugins/ha/ha_segments.c b/src/libcharon/plugins/ha/ha_segments.c index 688e09bdcc..6c21e8981b 100644 --- a/src/libcharon/plugins/ha/ha_segments.c +++ b/src/libcharon/plugins/ha/ha_segments.c @@ -348,6 +348,16 @@ static job_requeue_t send_status(private_ha_segments_t *this) return JOB_RESCHEDULE_MS(this->heartbeat_delay); } +/** + * Start the heartbeat sending task + */ +static void start_heartbeat(private_ha_segments_t *this) +{ + lib->processor->queue_job(lib->processor, + (job_t*)callback_job_create_with_prio((callback_job_cb_t)send_status, + this, NULL, (callback_job_cancel_t)return_false, JOB_PRIO_CRITICAL)); +} + METHOD(ha_segments_t, is_active, bool, private_ha_segments_t *this, u_int segment) { @@ -401,10 +411,9 @@ ha_segments_t *ha_segments_create(ha_socket_t *socket, ha_kernel_t *kernel, { DBG1(DBG_CFG, "starting HA heartbeat, delay %dms, timeout %dms", this->heartbeat_delay, this->heartbeat_timeout); - send_status(this); + start_heartbeat(this); start_watchdog(this); } return &this->public; } -