From: Daniel Wagner <daniel.wag...@bmw-carit.de> --- plugins/session_policy_local.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c index 0279863..60c3625 100644 --- a/plugins/session_policy_local.c +++ b/plugins/session_policy_local.c @@ -78,6 +78,8 @@ static void free_policy(gpointer user_data) { struct policy_data *policy = user_data; + DBG("policy %p", policy); + if (policy->config != NULL) g_slist_free(policy->config->allowed_bearers); @@ -130,6 +132,8 @@ static struct policy_data *create_policy(void) policy = g_new0(struct policy_data, 1); policy->refcount = 1; + DBG("policy %p", policy); + policy->config = connman_session_create_default_config(); policy_list = g_slist_prepend(policy_list, policy); @@ -481,10 +485,15 @@ static int load_policy(struct policy_data *policy) return err; } -static void update_session(struct connman_session *session) +static void update_session(struct policy_data *policy) { - if (connman_session_config_update(session) < 0) - connman_session_destroy(session); + DBG("policy %p session %p", policy, policy->session); + + if (policy->session == NULL) + return; + + if (connman_session_config_update(policy->session) < 0) + connman_session_destroy(policy->session); } static void remove_policy(struct policy_data *policy) @@ -501,7 +510,7 @@ static void remove_policy(struct policy_data *policy) return; connman_session_set_default_config(policy->config); - update_session(policy->session); + update_session(policy); } static void notify_handler(struct inotify_event *event, @@ -565,8 +574,7 @@ static void notify_handler(struct inotify_event *event, return; } - if (policy->session != NULL) - update_session(policy->session); + update_session(policy); } static void read_policies(void) @@ -605,6 +613,8 @@ static int session_policy_local_init(void) { int err; + DBG(""); + /* If the dir doesn't exist, create it */ if (g_file_test(POLICYDIR, G_FILE_TEST_IS_DIR) == FALSE) { if (mkdir(POLICYDIR, MODE) < 0) { @@ -653,6 +663,8 @@ err: static void session_policy_local_exit(void) { + DBG(""); + g_hash_table_destroy(session_hash); g_hash_table_destroy(file_hash); -- 1.8.1.3.566.gaa39828 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman