ikev2: Let ike/child-rekey tasks indicate if the passive task was adopted
This gives us more flexibility with tasks that return NEED_MORE (currently none of the colliding tasks do, but that will change with multi-KE rekeyings). The active task has to check itself if the passive task is done and should be removed from the task manager.
This commit is contained in:
@@ -872,13 +872,15 @@ static status_t process_response(private_task_manager_t *this,
|
||||
}
|
||||
|
||||
/**
|
||||
* handle exchange collisions
|
||||
* Handle exchange collisions, returns TRUE if the given passive task was
|
||||
* adopted by the active task and the task manager lost control over it.
|
||||
*/
|
||||
static bool handle_collisions(private_task_manager_t *this, task_t *task)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
task_t *active;
|
||||
task_type_t type;
|
||||
bool adopted = FALSE;
|
||||
|
||||
type = task->get_type(task);
|
||||
|
||||
@@ -896,7 +898,7 @@ static bool handle_collisions(private_task_manager_t *this, task_t *task)
|
||||
if (type == TASK_IKE_REKEY || type == TASK_IKE_DELETE)
|
||||
{
|
||||
ike_rekey_t *rekey = (ike_rekey_t*)active;
|
||||
rekey->collide(rekey, task);
|
||||
adopted = rekey->collide(rekey, task);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
@@ -904,7 +906,7 @@ static bool handle_collisions(private_task_manager_t *this, task_t *task)
|
||||
if (type == TASK_CHILD_REKEY || type == TASK_CHILD_DELETE)
|
||||
{
|
||||
child_rekey_t *rekey = (child_rekey_t*)active;
|
||||
rekey->collide(rekey, task);
|
||||
adopted = rekey->collide(rekey, task);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
@@ -912,11 +914,11 @@ static bool handle_collisions(private_task_manager_t *this, task_t *task)
|
||||
continue;
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
return TRUE;
|
||||
return adopted;
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
return FALSE;
|
||||
return adopted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user