splitted IKE_SA manager destroy to allow plugin interaction
This commit is contained in:
@@ -169,6 +169,10 @@ static void destroy(private_daemon_t *this)
|
|||||||
this->public.processor->set_threads(this->public.processor, 0);
|
this->public.processor->set_threads(this->public.processor, 0);
|
||||||
}
|
}
|
||||||
/* close all IKE_SAs */
|
/* close all IKE_SAs */
|
||||||
|
if (this->public.ike_sa_manager)
|
||||||
|
{
|
||||||
|
this->public.ike_sa_manager->flush(this->public.ike_sa_manager);
|
||||||
|
}
|
||||||
DESTROY_IF(this->public.plugins);
|
DESTROY_IF(this->public.plugins);
|
||||||
DESTROY_IF(this->public.ike_sa_manager);
|
DESTROY_IF(this->public.ike_sa_manager);
|
||||||
DESTROY_IF(this->public.kernel_interface);
|
DESTROY_IF(this->public.kernel_interface);
|
||||||
|
|||||||
@@ -898,9 +898,9 @@ static int get_half_open_count(private_ike_sa_manager_t *this, host_t *ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of ike_sa_manager_t.destroy.
|
* Implementation of ike_sa_manager_t.flush.
|
||||||
*/
|
*/
|
||||||
static void destroy(private_ike_sa_manager_t *this)
|
static void flush(private_ike_sa_manager_t *this)
|
||||||
{
|
{
|
||||||
/* destroy all list entries */
|
/* destroy all list entries */
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
@@ -943,9 +943,20 @@ static void destroy(private_ike_sa_manager_t *this)
|
|||||||
|
|
||||||
DBG2(DBG_MGR, "destroy all entries");
|
DBG2(DBG_MGR, "destroy all entries");
|
||||||
/* Step 4: destroy all entries */
|
/* Step 4: destroy all entries */
|
||||||
this->ike_sa_list->destroy_function(this->ike_sa_list, (void*)entry_destroy);
|
while (this->ike_sa_list->remove_last(this->ike_sa_list,
|
||||||
|
(void**)&entry) == SUCCESS)
|
||||||
|
{
|
||||||
|
entry_destroy(entry);
|
||||||
|
}
|
||||||
pthread_mutex_unlock(&(this->mutex));
|
pthread_mutex_unlock(&(this->mutex));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of ike_sa_manager_t.destroy.
|
||||||
|
*/
|
||||||
|
static void destroy(private_ike_sa_manager_t *this)
|
||||||
|
{
|
||||||
|
this->ike_sa_list->destroy(this->ike_sa_list);
|
||||||
this->rng->destroy(this->rng);
|
this->rng->destroy(this->rng);
|
||||||
this->hasher->destroy(this->hasher);
|
this->hasher->destroy(this->hasher);
|
||||||
|
|
||||||
@@ -960,6 +971,7 @@ ike_sa_manager_t *ike_sa_manager_create()
|
|||||||
private_ike_sa_manager_t *this = malloc_thing(private_ike_sa_manager_t);
|
private_ike_sa_manager_t *this = malloc_thing(private_ike_sa_manager_t);
|
||||||
|
|
||||||
/* assign public functions */
|
/* assign public functions */
|
||||||
|
this->public.flush = (void(*)(ike_sa_manager_t*))flush;
|
||||||
this->public.destroy = (void(*)(ike_sa_manager_t*))destroy;
|
this->public.destroy = (void(*)(ike_sa_manager_t*))destroy;
|
||||||
this->public.checkout = (ike_sa_t*(*)(ike_sa_manager_t*, ike_sa_id_t*))checkout;
|
this->public.checkout = (ike_sa_t*(*)(ike_sa_manager_t*, ike_sa_id_t*))checkout;
|
||||||
this->public.checkout_new = (ike_sa_t*(*)(ike_sa_manager_t*,bool))checkout_new;
|
this->public.checkout_new = (ike_sa_t*(*)(ike_sa_manager_t*,bool))checkout_new;
|
||||||
|
|||||||
@@ -199,10 +199,17 @@ struct ike_sa_manager_t {
|
|||||||
int (*get_half_open_count) (ike_sa_manager_t *this, host_t *ip);
|
int (*get_half_open_count) (ike_sa_manager_t *this, host_t *ip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the manager with all associated SAs.
|
* Delete all existing IKE_SAs and destroy them immediately.
|
||||||
*
|
*
|
||||||
* Threads will be driven out, so all SAs can be deleted cleanly.
|
* Threads will be driven out, so all SAs can be deleted cleanly.
|
||||||
*/
|
*/
|
||||||
|
void (*flush)(ike_sa_manager_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the manager with all associated SAs.
|
||||||
|
*
|
||||||
|
* A call to flush() is required before calling destroy.
|
||||||
|
*/
|
||||||
void (*destroy) (ike_sa_manager_t *this);
|
void (*destroy) (ike_sa_manager_t *this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user