Support flushing of task queue after building message in task fails
This commit is contained in:
@@ -277,8 +277,7 @@ METHOD(task_manager_t, initiate, status_t,
|
|||||||
host_t *me, *other;
|
host_t *me, *other;
|
||||||
status_t status;
|
status_t status;
|
||||||
exchange_type_t exchange = EXCHANGE_TYPE_UNDEFINED;
|
exchange_type_t exchange = EXCHANGE_TYPE_UNDEFINED;
|
||||||
bool new_mid = FALSE;
|
bool new_mid = FALSE, expect_response = FALSE, flushed = FALSE;
|
||||||
bool expect_response = FALSE;
|
|
||||||
|
|
||||||
if (!this->rng)
|
if (!this->rng)
|
||||||
{
|
{
|
||||||
@@ -431,6 +430,7 @@ METHOD(task_manager_t, initiate, status_t,
|
|||||||
continue;
|
continue;
|
||||||
case ALREADY_DONE:
|
case ALREADY_DONE:
|
||||||
flush_queue(this, this->active_tasks);
|
flush_queue(this, this->active_tasks);
|
||||||
|
flushed = TRUE;
|
||||||
break;
|
break;
|
||||||
case FAILED:
|
case FAILED:
|
||||||
default:
|
default:
|
||||||
@@ -454,6 +454,11 @@ METHOD(task_manager_t, initiate, status_t,
|
|||||||
{ /* tasks completed, no exchange active anymore */
|
{ /* tasks completed, no exchange active anymore */
|
||||||
this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
|
this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
if (flushed)
|
||||||
|
{
|
||||||
|
message->destroy(message);
|
||||||
|
return initiate(this);
|
||||||
|
}
|
||||||
this->initiating.seqnr++;
|
this->initiating.seqnr++;
|
||||||
|
|
||||||
status = this->ike_sa->generate_message(this->ike_sa, message,
|
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;
|
task_t *task;
|
||||||
message_t *message;
|
message_t *message;
|
||||||
host_t *me, *other;
|
host_t *me, *other;
|
||||||
bool delete = FALSE;
|
bool delete = FALSE, flushed = FALSE;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
me = request->get_destination(request);
|
me = request->get_destination(request);
|
||||||
@@ -549,6 +554,7 @@ static status_t build_response(private_task_manager_t *this, message_t *request)
|
|||||||
continue;
|
continue;
|
||||||
case ALREADY_DONE:
|
case ALREADY_DONE:
|
||||||
flush_queue(this, this->passive_tasks);
|
flush_queue(this, this->passive_tasks);
|
||||||
|
flushed = TRUE;
|
||||||
break;
|
break;
|
||||||
case FAILED:
|
case FAILED:
|
||||||
default:
|
default:
|
||||||
@@ -563,9 +569,13 @@ static status_t build_response(private_task_manager_t *this, message_t *request)
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
/* message complete, send it */
|
|
||||||
DESTROY_IF(this->responding.packet);
|
DESTROY_IF(this->responding.packet);
|
||||||
this->responding.packet = NULL;
|
this->responding.packet = NULL;
|
||||||
|
if (flushed)
|
||||||
|
{
|
||||||
|
message->destroy(message);
|
||||||
|
return initiate(this);
|
||||||
|
}
|
||||||
status = this->ike_sa->generate_message(this->ike_sa, message,
|
status = this->ike_sa->generate_message(this->ike_sa, message,
|
||||||
&this->responding.packet);
|
&this->responding.packet);
|
||||||
message->destroy(message);
|
message->destroy(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user