diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-06-08 21:08:01 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-06-08 21:08:01 +0000 |
commit | b8b8e6b88f04c18b851884341ecfbbc132bed583 (patch) | |
tree | de95f18642dfb108a74d4383a07489c523b4c510 | |
parent | 8bf636881f152a97727774f4f9ea2504c72dfb23 (diff) |
Split the D-Bus cleanup into two parts
-rw-r--r-- | hcid/dbus-common.c | 27 | ||||
-rw-r--r-- | hcid/dbus-common.h | 1 | ||||
-rw-r--r-- | hcid/main.c | 2 |
3 files changed, 20 insertions, 10 deletions
diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c index 734e2100..963de209 100644 --- a/hcid/dbus-common.c +++ b/hcid/dbus-common.c @@ -269,24 +269,18 @@ static void disconnect_callback(void *user_data) system_bus_reconnect, NULL); } -void hcid_dbus_exit(void) +void hcid_dbus_unregister(void) { - char **children; DBusConnection *conn = get_dbus_connection(); + char **children; int i; if (!conn || !dbus_connection_get_is_connected(conn)) return; - release_default_agent_old(); - release_default_auth_agent(); - release_services(conn); - - database_cleanup(conn, BASE_PATH); - /* Unregister all paths in Adapter path hierarchy */ if (!dbus_connection_list_registered(conn, BASE_PATH, &children)) - goto done; + return; for (i = 0; children[i]; i++) { char dev_path[MAX_PATH_LENGTH]; @@ -301,8 +295,21 @@ void hcid_dbus_exit(void) } dbus_free_string_array(children); +} + +void hcid_dbus_exit(void) +{ + DBusConnection *conn = get_dbus_connection(); + + if (!conn || !dbus_connection_get_is_connected(conn)) + return; + + release_default_agent_old(); + release_default_auth_agent(); + release_services(conn); + + database_cleanup(conn, BASE_PATH); -done: manager_cleanup(conn, BASE_PATH); set_dbus_connection(NULL); diff --git a/hcid/dbus-common.h b/hcid/dbus-common.h index 26af83ee..3ae9d7eb 100644 --- a/hcid/dbus-common.h +++ b/hcid/dbus-common.h @@ -37,6 +37,7 @@ int find_conn(int s, int dev_id, long arg); void hcid_dbus_exit(void); int hcid_dbus_init(void); +void hcid_dbus_unregister(void); void dbus_message_iter_append_dict_entry(DBusMessageIter *dict, const char *key, int type, void *val); diff --git a/hcid/main.c b/hcid/main.c index b415d6e5..59db359e 100644 --- a/hcid/main.c +++ b/hcid/main.c @@ -943,6 +943,8 @@ int main(int argc, char *argv[]) g_main_loop_run(event_loop); + hcid_dbus_unregister(); + plugin_cleanup(); stop_sdp_server(); |