summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzy <zhenye@broadcom.com>2013-10-08 16:54:08 -0700
committerMatthew Xie <mattx@google.com>2013-10-12 01:11:29 -0700
commit031d239b408618294a5980cb3933e03e185f96cf (patch)
tree2e12c0d25d489dff65a0564808ea43ee12133fe0
parent65b8e0f360f7fe7be001087c899eebc507115f9d (diff)
downloadbluedroid-kitkat-cts-dev.tar.gz
When rfcomm incoming queue is not empty, waiting for app ready to drain the dataandroid-cts-4.4_r1kitkat-cts-dev
Fixed the issue that rfcomm inbound packets could be out of order when host flow control is activating. bug 11031800 Change-Id: Idc1eb6633bb070f1ab2b33a9751fd7d714764d45
-rw-r--r--btif/src/btif_sock_rfc.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/btif/src/btif_sock_rfc.c b/btif/src/btif_sock_rfc.c
index 0669557..cdc51a9 100644
--- a/btif/src/btif_sock_rfc.c
+++ b/btif/src/btif_sock_rfc.c
@@ -939,25 +939,29 @@ int bta_co_rfc_data_incoming(void *user_data, BT_HDR *p_buf)
rfc_slot_t* rs = find_rfc_slot_by_id(id);
if(rs)
{
-
- int sent = send_data_to_app(rs->fd, p_buf);
- switch(sent)
+ if(!GKI_queue_is_empty(&rs->incoming_que))
+ GKI_enqueue(&rs->incoming_que, p_buf);
+ else
{
- case SENT_NONE:
- case SENT_PARTIAL:
- //add it to the end of the queue
- GKI_enqueue(&rs->incoming_que, p_buf);
- //monitor the fd to get callback when app is ready to receive data
- btsock_thread_add_fd(pth, rs->fd, BTSOCK_RFCOMM, SOCK_THREAD_FD_WR, rs->id);
- break;
- case SENT_ALL:
- GKI_freebuf(p_buf);
- ret = 1;//enable the data flow
- break;
- case SENT_FAILED:
- GKI_freebuf(p_buf);
- cleanup_rfc_slot(rs);
- break;
+ int sent = send_data_to_app(rs->fd, p_buf);
+ switch(sent)
+ {
+ case SENT_NONE:
+ case SENT_PARTIAL:
+ //add it to the end of the queue
+ GKI_enqueue(&rs->incoming_que, p_buf);
+ //monitor the fd to get callback when app is ready to receive data
+ btsock_thread_add_fd(pth, rs->fd, BTSOCK_RFCOMM, SOCK_THREAD_FD_WR, rs->id);
+ break;
+ case SENT_ALL:
+ GKI_freebuf(p_buf);
+ ret = 1;//enable the data flow
+ break;
+ case SENT_FAILED:
+ GKI_freebuf(p_buf);
+ cleanup_rfc_slot(rs);
+ break;
+ }
}
}
unlock_slot(&slot_lock);