ikev2: Allow tasks to do work after processing requests/responses
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2007-2018 Tobias Brunner
|
* Copyright (C) 2007-2019 Tobias Brunner
|
||||||
* Copyright (C) 2007-2010 Martin Willi
|
* Copyright (C) 2007-2010 Martin Willi
|
||||||
*
|
*
|
||||||
* Copyright (C) secunet Security Networks AG
|
* Copyright (C) secunet Security Networks AG
|
||||||
@@ -837,6 +837,31 @@ static status_t process_response(private_task_manager_t *this,
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
|
enumerator = array_create_enumerator(this->active_tasks);
|
||||||
|
while (enumerator->enumerate(enumerator, &task))
|
||||||
|
{
|
||||||
|
if (!task->post_process)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch (task->post_process(task, message))
|
||||||
|
{
|
||||||
|
case SUCCESS:
|
||||||
|
array_remove_at(this->active_tasks, enumerator);
|
||||||
|
task->destroy(task);
|
||||||
|
break;
|
||||||
|
case NEED_MORE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* critical failure, destroy IKE_SA */
|
||||||
|
array_remove_at(this->active_tasks, enumerator);
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
task->destroy(task);
|
||||||
|
return DESTROY_ME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
this->initiating.mid++;
|
this->initiating.mid++;
|
||||||
this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
|
this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
|
||||||
clear_packets(this->initiating.packets);
|
clear_packets(this->initiating.packets);
|
||||||
@@ -1314,6 +1339,31 @@ static status_t process_request(private_task_manager_t *this,
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
|
enumerator = array_create_enumerator(this->passive_tasks);
|
||||||
|
while (enumerator->enumerate(enumerator, &task))
|
||||||
|
{
|
||||||
|
if (!task->post_process)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch (task->post_process(task, message))
|
||||||
|
{
|
||||||
|
case SUCCESS:
|
||||||
|
array_remove_at(this->passive_tasks, enumerator);
|
||||||
|
task->destroy(task);
|
||||||
|
break;
|
||||||
|
case NEED_MORE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* critical failure, destroy IKE_SA */
|
||||||
|
array_remove_at(this->passive_tasks, enumerator);
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
task->destroy(task);
|
||||||
|
return DESTROY_ME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
return build_response(this, message);
|
return build_response(this, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user