summaryrefslogtreecommitdiffstats
path: root/dundee
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-08-14 04:14:32 -0300
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-08-17 14:59:50 +0200
commit371b886babde22618e584db73319a7420f60ee88 (patch)
tree077cf2d967d6ede94e90e9eb2c66ceaa7e1e11a9 /dundee
parent8181ee6b954e733c1947a456d57de6cf03d5db13 (diff)
downloadofono-371b886babde22618e584db73319a7420f60ee88.tar.bz2
dundee: explicit shutdown the bluetooth file descriptor
If we do not shut it down the fd can remain opened. This make impossible to try a re-connect: busy is returned in this case. We call shutdown here to make sure that the link is always closed.
Diffstat (limited to 'dundee')
-rw-r--r--dundee/bluetooth.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dundee/bluetooth.c b/dundee/bluetooth.c
index e2e2bcab..9ddc72c9 100644
--- a/dundee/bluetooth.c
+++ b/dundee/bluetooth.c
@@ -28,6 +28,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
+#include <sys/socket.h>
#include <glib.h>
@@ -44,6 +45,8 @@ struct bluetooth_device {
char *address;
char *name;
+ int fd;
+
DBusPendingCall *call;
};
@@ -54,6 +57,8 @@ static void bt_disconnect(struct dundee_device *device,
DBG("%p", bt);
+ shutdown(bt->fd, SHUT_RDWR);
+
CALLBACK_WITH_SUCCESS(cb, data);
}
@@ -93,6 +98,8 @@ static void bt_connect_reply(DBusPendingCall *call, gpointer user_data)
goto done;
}
+ bt->fd = fd;
+
CALLBACK_WITH_SUCCESS(cb, fd, cbd->data);
done: