summaryrefslogtreecommitdiff
path: root/android/avdtp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-12-19 17:15:55 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2013-12-20 09:26:54 +0200
commit9d893d60a99d9e7eb7a93e68c6f121b30e8c513d (patch)
treef886eb3213fcd4fac7d57693e00a74b4f16a31ca /android/avdtp.c
parentc9f7f76c2c3f4d116992309c9252fd7f85e5a321 (diff)
downloadbluez-9d893d60a99d9e7eb7a93e68c6f121b30e8c513d.tar.gz
android/AVDTP: Add avdtp_shutdown
avdtp_shutdown can be used to disconnect closing all existing stream properly.
Diffstat (limited to 'android/avdtp.c')
-rw-r--r--android/avdtp.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/android/avdtp.c b/android/avdtp.c
index b2d77a41e..7d3cb18a8 100644
--- a/android/avdtp.c
+++ b/android/avdtp.c
@@ -2102,6 +2102,25 @@ gboolean avdtp_remove_disconnect_cb(struct avdtp *session, unsigned int id)
return FALSE;
}
+void avdtp_shutdown(struct avdtp *session)
+{
+ GSList *l;
+ int sock;
+
+ if (!session->io)
+ return;
+
+ for (l = session->streams; l; l = g_slist_next(l)) {
+ struct avdtp_stream *stream = l->data;
+
+ avdtp_close(session, stream, TRUE);
+ }
+
+ sock = g_io_channel_unix_get_fd(session->io);
+
+ shutdown(sock, SHUT_RDWR);
+}
+
static void queue_request(struct avdtp *session, struct pending_req *req,
gboolean priority)
{