diff options
author | Martin Willi <martin@revosec.ch> | 2011-12-15 18:23:28 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:31:24 +0100 |
commit | b64d6423b17e9f63a7dc05d2ca59eda007dc97d8 (patch) | |
tree | 787cccd9d6ac14116f36487a0aeeb4053d86cdba /src | |
parent | fceb20f390789554e537ff606416cac2b4991ae6 (diff) | |
download | strongswan-b64d6423b17e9f63a7dc05d2ca59eda007dc97d8.tar.bz2 strongswan-b64d6423b17e9f63a7dc05d2ca59eda007dc97d8.tar.xz |
Support flushing of task queue after building message in task fails
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/sa/task_manager_v1.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libcharon/sa/task_manager_v1.c b/src/libcharon/sa/task_manager_v1.c index c10f63d0f..e18a070bf 100644 --- a/src/libcharon/sa/task_manager_v1.c +++ b/src/libcharon/sa/task_manager_v1.c @@ -277,8 +277,7 @@ METHOD(task_manager_t, initiate, status_t, host_t *me, *other; status_t status; exchange_type_t exchange = EXCHANGE_TYPE_UNDEFINED; - bool new_mid = FALSE; - bool expect_response = FALSE; + bool new_mid = FALSE, expect_response = FALSE, flushed = FALSE; if (!this->rng) { @@ -431,6 +430,7 @@ METHOD(task_manager_t, initiate, status_t, continue; case ALREADY_DONE: flush_queue(this, this->active_tasks); + flushed = TRUE; break; case FAILED: default: @@ -454,6 +454,11 @@ METHOD(task_manager_t, initiate, status_t, { /* tasks completed, no exchange active anymore */ this->initiating.type = EXCHANGE_TYPE_UNDEFINED; } + if (flushed) + { + message->destroy(message); + return initiate(this); + } this->initiating.seqnr++; status = this->ike_sa->generate_message(this->ike_sa, message, @@ -512,7 +517,7 @@ static status_t build_response(private_task_manager_t *this, message_t *request) task_t *task; message_t *message; host_t *me, *other; - bool delete = FALSE; + bool delete = FALSE, flushed = FALSE; status_t status; me = request->get_destination(request); @@ -549,6 +554,7 @@ static status_t build_response(private_task_manager_t *this, message_t *request) continue; case ALREADY_DONE: flush_queue(this, this->passive_tasks); + flushed = TRUE; break; case FAILED: default: @@ -563,9 +569,13 @@ static status_t build_response(private_task_manager_t *this, message_t *request) } enumerator->destroy(enumerator); - /* message complete, send it */ DESTROY_IF(this->responding.packet); this->responding.packet = NULL; + if (flushed) + { + message->destroy(message); + return initiate(this); + } status = this->ike_sa->generate_message(this->ike_sa, message, &this->responding.packet); message->destroy(message); |