aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-12-03 08:00:04 +0100
committerMartin Willi <martin@strongswan.org>2009-12-03 08:00:43 +0100
commitcd51437e4360e9267c5fe3193df9bf40837a9956 (patch)
tree70c61997caacc6aca4d29e1836e85335e07ba918
parentc636bc7e170dfe197d91406689b1c69b16ffe7c6 (diff)
downloadstrongswan-cd51437e4360e9267c5fe3193df9bf40837a9956.tar.bz2
strongswan-cd51437e4360e9267c5fe3193df9bf40837a9956.tar.xz
Do not execute the callback job if it has been cancelled since registration
-rw-r--r--src/charon/processing/jobs/callback_job.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/charon/processing/jobs/callback_job.c b/src/charon/processing/jobs/callback_job.c
index ee71fc557..ad51dc55d 100644
--- a/src/charon/processing/jobs/callback_job.c
+++ b/src/charon/processing/jobs/callback_job.c
@@ -126,6 +126,8 @@ static void cancel(private_callback_job_t *this)
pthread_cancel(thread);
pthread_join(thread, NULL);
}
+ /* avoid later execution of a cancelled job */
+ this->callback = NULL;
}
/**
@@ -142,13 +144,17 @@ static void execute(private_callback_job_t *this)
pthread_cleanup_push((void*)destroy, this);
while (TRUE)
{
+ if (this->callback == NULL)
+ {
+ cleanup = TRUE;
+ break;
+ }
switch (this->callback(this->data))
{
case JOB_REQUEUE_DIRECT:
continue;
case JOB_REQUEUE_FAIR:
{
- this->thread = 0;
charon->processor->queue_job(charon->processor,
&this->public.job_interface);
break;
@@ -156,13 +162,13 @@ static void execute(private_callback_job_t *this)
case JOB_REQUEUE_NONE:
default:
{
- this->thread = 0;
cleanup = TRUE;
break;
}
}
break;
}
+ this->thread = 0;
unregister(this);
pthread_cleanup_pop(cleanup);
}