mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-10 00:00:19 -04:00
Added a dedicated sender flush method, delay sender destruction until users gone
This commit is contained in:
parent
13de38e354
commit
f99d8b10c9
@ -109,8 +109,11 @@ static void destroy(private_daemon_t *this)
|
|||||||
{
|
{
|
||||||
this->public.traps->flush(this->public.traps);
|
this->public.traps->flush(this->public.traps);
|
||||||
}
|
}
|
||||||
|
if (this->public.sender)
|
||||||
|
{
|
||||||
|
this->public.sender->flush(this->public.sender);
|
||||||
|
}
|
||||||
DESTROY_IF(this->public.receiver);
|
DESTROY_IF(this->public.receiver);
|
||||||
DESTROY_IF(this->public.sender);
|
|
||||||
#ifdef ME
|
#ifdef ME
|
||||||
DESTROY_IF(this->public.connect_manager);
|
DESTROY_IF(this->public.connect_manager);
|
||||||
DESTROY_IF(this->public.mediation_manager);
|
DESTROY_IF(this->public.mediation_manager);
|
||||||
@ -129,6 +132,7 @@ static void destroy(private_daemon_t *this)
|
|||||||
DESTROY_IF(this->public.controller);
|
DESTROY_IF(this->public.controller);
|
||||||
DESTROY_IF(this->public.eap);
|
DESTROY_IF(this->public.eap);
|
||||||
DESTROY_IF(this->public.backends);
|
DESTROY_IF(this->public.backends);
|
||||||
|
DESTROY_IF(this->public.sender);
|
||||||
DESTROY_IF(this->public.socket);
|
DESTROY_IF(this->public.socket);
|
||||||
|
|
||||||
/* rehook library logging, shutdown logging */
|
/* rehook library logging, shutdown logging */
|
||||||
|
@ -149,7 +149,7 @@ static job_requeue_t send_packets(private_sender_t * this)
|
|||||||
return JOB_REQUEUE_DIRECT;
|
return JOB_REQUEUE_DIRECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(sender_t, destroy, void,
|
METHOD(sender_t, flush, void,
|
||||||
private_sender_t *this)
|
private_sender_t *this)
|
||||||
{
|
{
|
||||||
/* send all packets in the queue */
|
/* send all packets in the queue */
|
||||||
@ -159,8 +159,13 @@ METHOD(sender_t, destroy, void,
|
|||||||
this->sent->wait(this->sent, this->mutex);
|
this->sent->wait(this->sent, this->mutex);
|
||||||
}
|
}
|
||||||
this->mutex->unlock(this->mutex);
|
this->mutex->unlock(this->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD(sender_t, destroy, void,
|
||||||
|
private_sender_t *this)
|
||||||
|
{
|
||||||
this->job->cancel(this->job);
|
this->job->cancel(this->job);
|
||||||
this->list->destroy(this->list);
|
this->list->destroy_offset(this->list, offsetof(packet_t, destroy));
|
||||||
this->got->destroy(this->got);
|
this->got->destroy(this->got);
|
||||||
this->sent->destroy(this->sent);
|
this->sent->destroy(this->sent);
|
||||||
this->mutex->destroy(this->mutex);
|
this->mutex->destroy(this->mutex);
|
||||||
@ -177,6 +182,7 @@ sender_t * sender_create()
|
|||||||
INIT(this,
|
INIT(this,
|
||||||
.public = {
|
.public = {
|
||||||
.send = _send_,
|
.send = _send_,
|
||||||
|
.flush = _flush,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
.list = linked_list_create(),
|
.list = linked_list_create(),
|
||||||
|
@ -43,6 +43,13 @@ struct sender_t {
|
|||||||
*/
|
*/
|
||||||
void (*send) (sender_t *this, packet_t *packet);
|
void (*send) (sender_t *this, packet_t *packet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enforce a flush of the send queue.
|
||||||
|
*
|
||||||
|
* This function blocks until all queued packets have been sent.
|
||||||
|
*/
|
||||||
|
void (*flush)(sender_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a sender object.
|
* Destroys a sender object.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user