static void destroy(private_ha_sync_plugin_t *this)
{
DESTROY_IF(this->ctl);
+ charon->bus->remove_listener(charon->bus, &this->segments->listener);
charon->bus->remove_listener(charon->bus, &this->ike->listener);
charon->bus->remove_listener(charon->bus, &this->child->listener);
this->ike->destroy(this->ike);
this->dispatcher = ha_sync_dispatcher_create(this->socket, this->segments);
this->ike = ha_sync_ike_create(this->socket, this->tunnel);
this->child = ha_sync_child_create(this->socket, this->tunnel);
+ charon->bus->add_listener(charon->bus, &this->segments->listener);
charon->bus->add_listener(charon->bus, &this->ike->listener);
charon->bus->add_listener(charon->bus, &this->child->listener);
list->destroy(list);
}
+/**
+ * Implementation of listener_t.alert
+ */
+static bool alert_hook(private_ha_sync_segments_t *this, ike_sa_t *ike_sa,
+ alert_t alert, va_list args)
+{
+ if (alert == ALERT_SHUTDOWN_SIGNAL)
+ {
+ int i;
+
+ for (i = 0; i < SEGMENTS_MAX; i++)
+ {
+ if (this->active & SEGMENTS_BIT(i))
+ {
+ deactivate(this, i, TRUE);
+ }
+ }
+ }
+ return TRUE;
+}
+
/**
* Implementation of ha_sync_segments_t.destroy.
*/
{
private_ha_sync_segments_t *this = malloc_thing(private_ha_sync_segments_t);
+ memset(&this->public.listener, 0, sizeof(listener_t));
+ this->public.listener.alert = (bool(*)(listener_t*, ike_sa_t *, alert_t, va_list))alert_hook;
this->public.activate = (void(*)(ha_sync_segments_t*, u_int segment,bool))activate;
this->public.deactivate = (void(*)(ha_sync_segments_t*, u_int segment,bool))deactivate;
this->public.resync = (void(*)(ha_sync_segments_t*, u_int segment))resync;