diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-06-19 10:45:17 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-06-25 17:10:28 +0200 |
commit | 7fec83af28f233a02b7ae08c6fd4de65799cb6b4 (patch) | |
tree | c1093faa3be57635e0cb8baf112c6edfaa3001e9 /src/libcharon/control | |
parent | 18d21a57df6085e1738a92d5a352ec17d314a753 (diff) | |
download | strongswan-7fec83af28f233a02b7ae08c6fd4de65799cb6b4.tar.bz2 strongswan-7fec83af28f233a02b7ae08c6fd4de65799cb6b4.tar.xz |
Give processor_t more control over the lifecycle of a job
Jobs are now destroyed by the processor, but they are allowed to
reschedule themselves. That is, parts of the reschedule functionality
already provided by callback_job_t is moved to the processor. Not yet
fully supported is JOB_REQUEUE_DIRECT and canceling jobs.
Note: job_t.destroy() is now called not only for queued jobs but also
after execution or cancellation of jobs. job_t.status can be used to
decide what to do in said method.
Diffstat (limited to 'src/libcharon/control')
-rw-r--r-- | src/libcharon/control/controller.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libcharon/control/controller.c b/src/libcharon/control/controller.c index c23bf044e..be691178d 100644 --- a/src/libcharon/control/controller.c +++ b/src/libcharon/control/controller.c @@ -290,7 +290,8 @@ METHOD(listener_t, child_state_change, bool, METHOD(job_t, recheckin, void, interface_job_t *job) { - if (job->listener.ike_sa) + if (job->public.status == JOB_STATUS_QUEUED && + job->listener.ike_sa) { charon->ike_sa_manager->checkin(charon->ike_sa_manager, job->listener.ike_sa); @@ -304,7 +305,7 @@ METHOD(controller_t, create_ike_sa_enumerator, enumerator_t*, wait); } -METHOD(job_t, initiate_execute, void, +METHOD(job_t, initiate_execute, job_requeue_t, interface_job_t *job) { ike_sa_t *ike_sa; @@ -322,7 +323,7 @@ METHOD(job_t, initiate_execute, void, charon->ike_sa_manager, IKE_ANY, TRUE); DESTROY_IF(listener->ike_sa); listener->status = FAILED; - return; + return JOB_REQUEUE_NONE; } listener->ike_sa = ike_sa; @@ -343,6 +344,7 @@ METHOD(job_t, initiate_execute, void, ike_sa); listener->status = FAILED; } + return JOB_REQUEUE_NONE; } METHOD(controller_t, initiate, status_t, @@ -389,7 +391,7 @@ METHOD(controller_t, initiate, status_t, return job.listener.status; } -METHOD(job_t, terminate_ike_execute, void, +METHOD(job_t, terminate_ike_execute, job_requeue_t, interface_job_t *job) { interface_listener_t *listener = &job->listener; @@ -409,6 +411,7 @@ METHOD(job_t, terminate_ike_execute, void, ike_sa); listener->status = SUCCESS; } + return JOB_REQUEUE_NONE; } METHOD(controller_t, terminate_ike, status_t, @@ -466,7 +469,7 @@ METHOD(controller_t, terminate_ike, status_t, return job.listener.status; } -METHOD(job_t, terminate_child_execute, void, +METHOD(job_t, terminate_child_execute, job_requeue_t, interface_job_t *job) { interface_listener_t *listener = &job->listener; @@ -486,6 +489,7 @@ METHOD(job_t, terminate_child_execute, void, ike_sa); listener->status = FAILED; } + return JOB_REQUEUE_NONE; } METHOD(controller_t, terminate_child, status_t, |