summaryrefslogtreecommitdiff
path: root/src/charon/control/interfaces/dbus_interface.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2007-07-05 00:05:56 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2007-07-05 00:05:56 +0000
commit5db544cc26db378616a46dfa22138f0008cf2930 (patch)
treeff9254d87967bb6f703a5ab5e63edcde2e8a6c17 /src/charon/control/interfaces/dbus_interface.c
parent3d44c2edf1a3663c7d4acc4434bc8a3abace1ebf (diff)
downloadvyos-strongswan-5db544cc26db378616a46dfa22138f0008cf2930.tar.gz
vyos-strongswan-5db544cc26db378616a46dfa22138f0008cf2930.zip
- Updated to new upstream release.
Diffstat (limited to 'src/charon/control/interfaces/dbus_interface.c')
-rw-r--r--src/charon/control/interfaces/dbus_interface.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/charon/control/interfaces/dbus_interface.c b/src/charon/control/interfaces/dbus_interface.c
index 443df635c..d93a5d048 100644
--- a/src/charon/control/interfaces/dbus_interface.c
+++ b/src/charon/control/interfaces/dbus_interface.c
@@ -30,6 +30,7 @@
#include <library.h>
#include <daemon.h>
+#include <processing/jobs/callback_job.h>
#define NM_DBUS_SERVICE_STRONG "org.freedesktop.NetworkManager.strongswan"
@@ -64,9 +65,9 @@ struct private_dbus_interface_t {
NMVPNState state;
/**
- * dispatcher thread for DBUS messages
+ * job accepting stroke messages
*/
- pthread_t thread;
+ callback_job_t *job;
/**
* name of the currently active connection
@@ -392,14 +393,13 @@ static DBusHandlerResult signal_handler(DBusConnection *con, DBusMessage *msg,
/**
* dispatcher function processed by a seperate thread
*/
-static void dispatch(private_dbus_interface_t *this)
+static job_requeue_t dispatch(private_dbus_interface_t *this)
{
- charon->drop_capabilities(charon, TRUE);
-
- while (dbus_connection_read_write_dispatch(this->conn, -1))
+ if (dbus_connection_read_write_dispatch(this->conn, -1))
{
- /* nothing */
+ return JOB_REQUEUE_DIRECT;
}
+ return JOB_REQUEUE_NONE;
}
/**
@@ -407,8 +407,7 @@ static void dispatch(private_dbus_interface_t *this)
*/
static void destroy(private_dbus_interface_t *this)
{
- pthread_cancel(this->thread);
- pthread_join(this->thread, NULL);
+ this->job->cancel(this->job);
dbus_connection_close(this->conn);
dbus_error_free(&this->err);
dbus_shutdown();
@@ -469,10 +468,8 @@ interface_t *interface_create()
this->state = NM_VPN_STATE_INIT;
set_state(this, NM_VPN_STATE_STOPPED);
- if (pthread_create(&this->thread, NULL, (void*(*)(void*))dispatch, this) != 0)
- {
- charon->kill(charon, "unable to create stroke thread");
- }
+ this->job = callback_job_create((callback_job_cb_t)dispatch, this, NULL, NULL);
+ charon->processor->queue_job(charon->processor, (job_t*)this->job);
return &this->public.interface;
}