diff options
Diffstat (limited to 'src/charon/plugins/nm/nm_plugin.c')
-rw-r--r-- | src/charon/plugins/nm/nm_plugin.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/charon/plugins/nm/nm_plugin.c b/src/charon/plugins/nm/nm_plugin.c index 1336293f4..1fb46f814 100644 --- a/src/charon/plugins/nm/nm_plugin.c +++ b/src/charon/plugins/nm/nm_plugin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Martin Willi + * Copyright (C) 2008-2009 Martin Willi * Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it @@ -11,13 +11,12 @@ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. - * - * $Id$ */ #include "nm_plugin.h" #include "nm_service.h" #include "nm_creds.h" +#include "nm_handler.h" #include <daemon.h> #include <processing/jobs/callback_job.h> @@ -50,6 +49,11 @@ struct private_nm_plugin_t { * credential set registered at the daemon */ nm_creds_t *creds; + + /** + * attribute handler regeisterd at the daemon + */ + nm_handler_t *handler; }; /** @@ -59,8 +63,6 @@ static job_requeue_t run(private_nm_plugin_t *this) { this->loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(this->loop); - g_main_loop_unref(this->loop); - return JOB_REQUEUE_NONE; } @@ -71,7 +73,11 @@ static void destroy(private_nm_plugin_t *this) { if (this->loop) { - g_main_loop_quit(this->loop); + if (g_main_loop_is_running(this->loop)) + { + g_main_loop_quit(this->loop); + } + g_main_loop_unref(this->loop); } if (this->plugin) { @@ -79,6 +85,8 @@ static void destroy(private_nm_plugin_t *this) } charon->credentials->remove_set(charon->credentials, &this->creds->set); this->creds->destroy(this->creds); + charon->attributes->remove_handler(charon->attributes, &this->handler->handler); + this->handler->destroy(this->handler); free(this); } @@ -99,8 +107,10 @@ plugin_t *plugin_create() } this->creds = nm_creds_create(); + this->handler = nm_handler_create(); charon->credentials->add_set(charon->credentials, &this->creds->set); - this->plugin = nm_strongswan_plugin_new(this->creds); + charon->attributes->add_handler(charon->attributes, &this->handler->handler); + this->plugin = nm_strongswan_plugin_new(this->creds, this->handler); if (!this->plugin) { DBG1(DBG_CFG, "DBUS binding failed"); |