summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzy <zhenye@broadcom.com>2013-05-13 17:34:41 -0700
committerMatthew Xie <mattx@google.com>2013-05-13 18:58:29 -0700
commitebef4763b36b05370d13dfd27c4fcaa9095dbeff (patch)
treeb4bf0d0beb685e92869560f98fad6e22341c9046
parent5fd74f06caab4324d0ba69df86ad5170c072ec64 (diff)
downloadbluedroid-ebef4763b36b05370d13dfd27c4fcaa9095dbeff.tar.gz
Added available size check to fix zero byte data available issue
Bug 8950703 rfcomm connection failed in case zero byte data available
-rw-r--r--stack/rfcomm/port_api.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/stack/rfcomm/port_api.c b/stack/rfcomm/port_api.c
index 325d8fa..cba153e 100644
--- a/stack/rfcomm/port_api.c
+++ b/stack/rfcomm/port_api.c
@@ -1437,6 +1437,8 @@ int PORT_WriteDataCO (UINT16 handle, int* p_len)
RFCOMM_TRACE_ERROR1("p_data_co_callback DATA_CO_CALLBACK_TYPE_INCOMING_SIZE failed, available:%d", available);
return (PORT_UNKNOWN_ERROR);
}
+ if(available == 0)
+ return PORT_SUCCESS;
/* Length for each buffer is the smaller of GKI buffer, peer MTU, or max_len */
length = RFCOMM_DATA_POOL_BUF_SIZE -
(UINT16)(sizeof(BT_HDR) + L2CAP_MIN_OFFSET + RFCOMM_DATA_OVERHEAD);
@@ -1455,6 +1457,7 @@ int PORT_WriteDataCO (UINT16 handle, int* p_len)
{
error("p_data_co_callback DATA_CO_CALLBACK_TYPE_OUTGOING failed, available:%d", available);
+ PORT_SCHEDULE_UNLOCK;
return (PORT_UNKNOWN_ERROR);
}
//memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);