summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorPaulo Borges <paulo.borges@openbossa.org>2013-04-19 19:19:03 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-04-22 03:53:42 -0500
commitd062d485d6d88af8ef5612a6edb964b2acae7ed2 (patch)
tree1482552493fac48b85250266e71ec93e9fb50e2a /plugins
parentfc7de0f6e18e6b9cf874207cc78d9993d122f3ff (diff)
downloadofono-d062d485d6d88af8ef5612a6edb964b2acae7ed2.tar.bz2
hfp_ag_bluez5: Create a hash to store connections
We need to store active connections so we can disconnect them at RequestDisconnect(). When we remove a connection from the hash, we also close it.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/hfp_ag_bluez5.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/hfp_ag_bluez5.c b/plugins/hfp_ag_bluez5.c
index c171c875..bbced263 100644
--- a/plugins/hfp_ag_bluez5.c
+++ b/plugins/hfp_ag_bluez5.c
@@ -48,6 +48,16 @@
static guint modemwatch_id;
static GList *modems;
static GHashTable *sim_hash = NULL;
+static GHashTable *connection_hash;
+
+static void connection_destroy(gpointer data)
+{
+ int fd = GPOINTER_TO_INT(data);
+
+ DBG("fd %d", fd);
+
+ close(fd);
+}
static DBusMessage *profile_new_connection(DBusConnection *conn,
DBusMessage *msg, void *data)
@@ -251,6 +261,9 @@ static int hfp_ag_init(void)
modemwatch_id = __ofono_modemwatch_add(modem_watch, NULL, NULL);
__ofono_modem_foreach(call_modemwatch, NULL);
+ connection_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, connection_destroy);
+
return 0;
}
@@ -262,6 +275,8 @@ static void hfp_ag_exit(void)
g_dbus_unregister_interface(conn, HFP_AG_EXT_PROFILE_PATH,
BLUEZ_PROFILE_INTERFACE);
+ g_hash_table_destroy(connection_hash);
+
g_list_free(modems);
g_hash_table_foreach_remove(sim_hash, sim_watch_remove, NULL);
g_hash_table_destroy(sim_hash);