Hi Paulo,
On 04/19/2013 10:00 AM, Paulo Borges wrote:
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.
---
plugins/hfp_ag_bluez5.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/plugins/hfp_ag_bluez5.c b/plugins/hfp_ag_bluez5.c
index c171c87..edc76e6 100644
--- a/plugins/hfp_ag_bluez5.c
+++ b/plugins/hfp_ag_bluez5.c
@@ -48,6 +48,17 @@
static guint modemwatch_id;
static GList *modems;
static GHashTable *sim_hash = NULL;
+static GHashTable *connection_hash;
+
+static void connection_removed_notify(gpointer data)
+{
+ int fd = GPOINTER_TO_INT(data);
+
+ DBG("%d", fd);
+
+ shutdown(fd, SHUT_RDWR);
+ close(fd);
+}
I will be a bit nit-picky here, but shutdown() does not belong here.
You only want to do this inside the RequestDisconnection() implementation.
Also, please name this function connection_destroy().
Regards,
-Denis