Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b51794b authored by zzy's avatar zzy Committed by Matthew Xie
Browse files

Added available size check to fix zero byte data available issue

Bug 8950703
      rfcomm connection failed in case zero byte data available
parent a0d63a9c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);