Give processor_t more control over the lifecycle of a job
[strongswan.git] / src / libcharon / processing / jobs / roam_job.c
index 2e9d887..0af4c6c 100644 (file)
@@ -44,7 +44,7 @@ METHOD(job_t, destroy, void,
        free(this);
 }
 
-METHOD(job_t, execute, void,
+METHOD(job_t, execute, job_requeue_t,
        private_roam_job_t *this)
 {
        ike_sa_t *ike_sa;
@@ -55,7 +55,8 @@ METHOD(job_t, execute, void,
        /* enumerator over all IKE_SAs gives us no way to checkin_and_destroy
         * after a DESTROY_ME, so we check out each available IKE_SA by hand. */
        list = linked_list_create();
-       enumerator = charon->ike_sa_manager->create_enumerator(charon->ike_sa_manager);
+       enumerator = charon->ike_sa_manager->create_enumerator(
+                                                                                               charon->ike_sa_manager, TRUE);
        while (enumerator->enumerate(enumerator, &ike_sa))
        {
                id = ike_sa->get_id(ike_sa);
@@ -81,8 +82,7 @@ METHOD(job_t, execute, void,
                id->destroy(id);
        }
        list->destroy(list);
-
-       destroy(this);
+       return JOB_REQUEUE_NONE;
 }
 
 METHOD(job_t, get_priority, job_priority_t,