summaryrefslogtreecommitdiffstats
path: root/btif/src/btif_profile_queue.c
diff options
context:
space:
mode:
authorSharvil Nanavati <sharvil@google.com>2014-10-27 16:56:42 -0700
committerAndre Eisenbach <eisenbach@google.com>2015-03-16 16:51:38 -0700
commiteacc69d09256ecaa7c01ea066cd70b0049edc23b (patch)
tree52eabecc7780cefb29bdcbc3d69e62b9269e7384 /btif/src/btif_profile_queue.c
parent78a51cb6c9efdc643aa812964adf5de6367eb477 (diff)
downloadandroid_system_bt-eacc69d09256ecaa7c01ea066cd70b0049edc23b.tar.gz
android_system_bt-eacc69d09256ecaa7c01ea066cd70b0049edc23b.tar.bz2
android_system_bt-eacc69d09256ecaa7c01ea066cd70b0049edc23b.zip
Don't dispatch connections in the connection queue until stack comes up.
Bug: 18139425
Diffstat (limited to 'btif/src/btif_profile_queue.c')
-rw-r--r--btif/src/btif_profile_queue.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/btif/src/btif_profile_queue.c b/btif/src/btif_profile_queue.c
index 12cec2e00..5dbe8f2b7 100644
--- a/btif/src/btif_profile_queue.c
+++ b/btif/src/btif_profile_queue.c
@@ -31,6 +31,7 @@
#include "btif_profile_queue.h"
#include "gki.h"
#include "list.h"
+#include "stack_manager.h"
/*******************************************************************************
** Local type definitions
@@ -77,21 +78,6 @@ static void queue_int_advance() {
list_remove(connect_queue, list_front(connect_queue));
}
-static bt_status_t queue_int_connect_next() {
- if (!connect_queue || list_is_empty(connect_queue))
- return BT_STATUS_FAIL;
-
- connect_node_t *p_head = list_front(connect_queue);
-
- // If the queue is currently busy, we return success anyway,
- // since the connection has been queued...
- if (p_head->busy)
- return BT_STATUS_SUCCESS;
-
- p_head->busy = true;
- return p_head->connect_cb(&p_head->bda, p_head->uuid);
-}
-
static void queue_int_handle_evt(UINT16 event, char *p_param) {
switch(event) {
case BTIF_QUEUE_CONNECT_EVT:
@@ -103,7 +89,8 @@ static void queue_int_handle_evt(UINT16 event, char *p_param) {
break;
}
- queue_int_connect_next();
+ if (stack_manager_get_interface()->get_stack_is_running())
+ btif_queue_connect_next();
}
/*******************************************************************************
@@ -142,6 +129,24 @@ void btif_queue_advance() {
NULL, 0, NULL);
}
+// This function dispatches the next pending connect request. It is called from
+// stack_manager when the stack comes up.
+bt_status_t btif_queue_connect_next(void) {
+ if (!connect_queue || list_is_empty(connect_queue))
+ return BT_STATUS_FAIL;
+
+ connect_node_t *p_head = list_front(connect_queue);
+
+ // If the queue is currently busy, we return success anyway,
+ // since the connection has been queued...
+ if (p_head->busy)
+ return BT_STATUS_SUCCESS;
+
+ p_head->busy = true;
+ return p_head->connect_cb(&p_head->bda, p_head->uuid);
+}
+
+
/*******************************************************************************
**
** Function btif_queue_release