[PATCH BlueZ 3/4] android/AVDTP: Add avdtp_shutdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

avdtp_shutdown can be used to disconnect closing all existing stream
properly.
---
 android/avdtp.c | 19 +++++++++++++++++++
 android/avdtp.h |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/android/avdtp.c b/android/avdtp.c
index b2d77a4..7d3cb18 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)
 {
diff --git a/android/avdtp.h b/android/avdtp.h
index 1619029..d371653 100644
--- a/android/avdtp.h
+++ b/android/avdtp.h
@@ -209,6 +209,8 @@ unsigned int avdtp_add_disconnect_cb(struct avdtp *session,
 						void *user_data);
 gboolean avdtp_remove_disconnect_cb(struct avdtp *session, unsigned int id);
 
+void avdtp_shutdown(struct avdtp *session);
+
 void avdtp_unref(struct avdtp *session);
 struct avdtp *avdtp_ref(struct avdtp *session);
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux