[PATCH BlueZ] Fix release all sessions on powering adapter off

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

 



When adapter is powered off, all sessions should be released without
changing mode, which is contrary to what session_remove does. This
prevents from such situation when powering off leads to new mode
derived from mode_sessions.

Currently, if there are multiple mode sessions requested by different
clients, powering adapter off results in powering immediately it on.
---
 src/adapter.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index d1ef17c..6d982a0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2313,19 +2313,9 @@ static void set_mode_complete(struct btd_adapter *adapter)
 
 	DBG("");
 
-	/*
-	 * g_slist_free is not called after g_slist_foreach because the list is
-	 * updated using g_slist_remove in session_remove.
-	 */
 	if (adapter->mode == MODE_OFF) {
-		GSList *l;
-
-		for (l = adapter->mode_sessions; l;) {
-			struct session_req *req = l->data;
-			l = g_slist_next(l);
-			session_remove(req);
-			session_free(req);
-		}
+		g_slist_free_full(adapter->mode_sessions, session_free);
+		adapter->mode_sessions = NULL;
 	}
 
 	if (adapter->pending_mode == NULL)
-- 
1.7.4.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