diff options
author | Martin Willi <martin@revosec.ch> | 2012-05-02 09:03:23 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-05-02 10:22:59 +0200 |
commit | f99d8b10c9f5b5024b4b1e5f5d1e56e2519cdadc (patch) | |
tree | c675eb2564affb806336942de5387ad2ad668c0b /src/libcharon/network/sender.c | |
parent | 13de38e354c055b2c8a5e95fc2e1cb793782bf27 (diff) | |
download | strongswan-f99d8b10c9f5b5024b4b1e5f5d1e56e2519cdadc.tar.bz2 strongswan-f99d8b10c9f5b5024b4b1e5f5d1e56e2519cdadc.tar.xz |
Added a dedicated sender flush method, delay sender destruction until users gone
Diffstat (limited to 'src/libcharon/network/sender.c')
-rw-r--r-- | src/libcharon/network/sender.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcharon/network/sender.c b/src/libcharon/network/sender.c index 4df930b15..6d5ad8f2a 100644 --- a/src/libcharon/network/sender.c +++ b/src/libcharon/network/sender.c @@ -149,7 +149,7 @@ static job_requeue_t send_packets(private_sender_t * this) return JOB_REQUEUE_DIRECT; } -METHOD(sender_t, destroy, void, +METHOD(sender_t, flush, void, private_sender_t *this) { /* send all packets in the queue */ @@ -159,8 +159,13 @@ METHOD(sender_t, destroy, void, this->sent->wait(this->sent, this->mutex); } this->mutex->unlock(this->mutex); +} + +METHOD(sender_t, destroy, void, + private_sender_t *this) +{ 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->sent->destroy(this->sent); this->mutex->destroy(this->mutex); @@ -177,6 +182,7 @@ sender_t * sender_create() INIT(this, .public = { .send = _send_, + .flush = _flush, .destroy = _destroy, }, .list = linked_list_create(), |