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

Commit c8a31eb4 authored by zzy's avatar zzy Committed by Android Git Automerger
Browse files

am 6b51794b: Added available size check to fix zero byte data available issue

* commit '6b51794b':
  Added available size check to fix zero byte data available issue
parents a7a133b2 6b51794b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line 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);
        RFCOMM_TRACE_ERROR1("p_data_co_callback DATA_CO_CALLBACK_TYPE_INCOMING_SIZE failed, available:%d", available);
        return (PORT_UNKNOWN_ERROR);
        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 for each buffer is the smaller of GKI buffer, peer MTU, or max_len */
    length = RFCOMM_DATA_POOL_BUF_SIZE -
    length = RFCOMM_DATA_POOL_BUF_SIZE -
            (UINT16)(sizeof(BT_HDR) + L2CAP_MIN_OFFSET + RFCOMM_DATA_OVERHEAD);
            (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);
            error("p_data_co_callback DATA_CO_CALLBACK_TYPE_OUTGOING failed, available:%d", available);
            PORT_SCHEDULE_UNLOCK;
            return (PORT_UNKNOWN_ERROR);
            return (PORT_UNKNOWN_ERROR);
        }
        }
        //memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);
        //memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);