aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/whitelist/whitelist_control.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-06-19 13:29:09 +0200
committerTobias Brunner <tobias@strongswan.org>2012-06-25 17:38:59 +0200
commit26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f (patch)
tree5d5b7bd7bb2cd6a721c65b82f8ce2a8b3f4fdf22 /src/libcharon/plugins/whitelist/whitelist_control.c
parent7fec83af28f233a02b7ae08c6fd4de65799cb6b4 (diff)
downloadstrongswan-26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f.tar.bz2
strongswan-26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f.tar.xz
Centralized thread cancellation in processor_t
This ensures that no threads are active when plugins and the rest of the daemon are unloaded. callback_job_t was simplified a lot in the process as its main functionality is now contained in processor_t. The parent-child relationships were abandoned as these were only needed to simplify job cancellation.
Diffstat (limited to 'src/libcharon/plugins/whitelist/whitelist_control.c')
-rw-r--r--src/libcharon/plugins/whitelist/whitelist_control.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/libcharon/plugins/whitelist/whitelist_control.c b/src/libcharon/plugins/whitelist/whitelist_control.c
index 202c9a418..0c20bd1aa 100644
--- a/src/libcharon/plugins/whitelist/whitelist_control.c
+++ b/src/libcharon/plugins/whitelist/whitelist_control.c
@@ -49,11 +49,6 @@ struct private_whitelist_control_t {
* Whitelist unix socket file descriptor
*/
int socket;
-
- /**
- * Callback job dispatching commands
- */
- callback_job_t *job;
};
/**
@@ -200,7 +195,6 @@ static job_requeue_t receive(private_whitelist_control_t *this)
METHOD(whitelist_control_t, destroy, void,
private_whitelist_control_t *this)
{
- this->job->cancel(this->job);
close(this->socket);
free(this);
}
@@ -225,9 +219,9 @@ whitelist_control_t *whitelist_control_create(whitelist_listener_t *listener)
return NULL;
}
- this->job = callback_job_create_with_prio((callback_job_cb_t)receive,
- this, NULL, NULL, JOB_PRIO_CRITICAL);
- lib->processor->queue_job(lib->processor, (job_t*)this->job);
+ lib->processor->queue_job(lib->processor,
+ (job_t*)callback_job_create_with_prio((callback_job_cb_t)receive, this,
+ NULL, (callback_job_cancel_t)return_false, JOB_PRIO_CRITICAL));
return &this->public;
}