Loading system/bta/include/bta_jv_api.h +0 −2 Original line number Diff line number Diff line Loading @@ -246,7 +246,6 @@ typedef struct { uint32_t handle; /* The connection handle */ uint32_t req_id; /* The req_id in the associated BTA_JvL2capWrite() */ uint16_t len; /* The length of the data written. */ uint8_t* p_data; /* The buffer where data is held */ bool cong; /* congestion status */ } tBTA_JV_L2CAP_WRITE; Loading @@ -256,7 +255,6 @@ typedef struct { uint16_t channel; /* The connection channel */ RawAddress addr; /* The peer address */ uint32_t req_id; /* The req_id in the associated BTA_JvL2capWrite() */ uint8_t* p_data; /* The buffer where data is held */ uint16_t len; /* The length of the data written. */ bool cong; /* congestion status */ } tBTA_JV_L2CAP_WRITE_FIXED; Loading system/bta/jv/bta_jv_act.cc +6 −2 Original line number Diff line number Diff line Loading @@ -1154,6 +1154,7 @@ void bta_jv_l2cap_write(uint32_t handle, uint32_t req_id, uint8_t* p_data, * channel is disconnected after the API function is called, but before the * message is handled. */ LOG(ERROR) << __func__ << ": p_cb->p_cback == NULL"; osi_free(p_data); return; } Loading @@ -1161,7 +1162,6 @@ void bta_jv_l2cap_write(uint32_t handle, uint32_t req_id, uint8_t* p_data, evt_data.status = BTA_JV_FAILURE; evt_data.handle = handle; evt_data.req_id = req_id; evt_data.p_data = p_data; evt_data.cong = p_cb->cong; evt_data.len = 0; bta_jv_pm_conn_busy(p_cb->p_pm_cb); Loading @@ -1169,6 +1169,9 @@ void bta_jv_l2cap_write(uint32_t handle, uint32_t req_id, uint8_t* p_data, BT_PASS == GAP_ConnWriteData(handle, p_data, len, &evt_data.len)) { evt_data.status = BTA_JV_SUCCESS; } osi_free(p_data); tBTA_JV bta_jv; bta_jv.l2c_write = evt_data; p_cb->p_cback(BTA_JV_L2CAP_WRITE_EVT, &bta_jv, user_id); Loading @@ -1183,7 +1186,6 @@ void bta_jv_l2cap_write_fixed(uint16_t channel, const RawAddress& addr, evt_data.channel = channel; evt_data.addr = addr; evt_data.req_id = req_id; evt_data.p_data = p_data; evt_data.len = 0; BT_HDR* msg = (BT_HDR*)osi_malloc(sizeof(BT_HDR) + len + L2CAP_MIN_OFFSET); Loading @@ -1191,6 +1193,8 @@ void bta_jv_l2cap_write_fixed(uint16_t channel, const RawAddress& addr, msg->len = len; msg->offset = L2CAP_MIN_OFFSET; osi_free(p_data); L2CA_SendFixedChnlData(channel, addr, msg); tBTA_JV bta_jv; Loading system/bta/jv/bta_jv_api.cc +7 −3 Original line number Diff line number Diff line Loading @@ -506,7 +506,8 @@ tBTA_JV_STATUS BTA_JvL2capReady(uint32_t handle, uint32_t* p_data_size) { * Description This function writes data to an L2CAP connection * When the operation is complete, tBTA_JV_L2CAP_CBACK is * called with BTA_JV_L2CAP_WRITE_EVT. Works for * PSM-based connections * PSM-based connections. This function takes ownership of * p_data, and will osi_free it. * * Returns BTA_JV_SUCCESS, if the request is being processed. * BTA_JV_FAILURE, otherwise. Loading @@ -517,8 +518,10 @@ tBTA_JV_STATUS BTA_JvL2capWrite(uint32_t handle, uint32_t req_id, uint32_t user_id) { VLOG(2) << __func__; if (handle >= BTA_JV_MAX_L2C_CONN || !bta_jv_cb.l2c_cb[handle].p_cback) if (handle >= BTA_JV_MAX_L2C_CONN || !bta_jv_cb.l2c_cb[handle].p_cback) { osi_free(p_data); return BTA_JV_FAILURE; } do_in_bta_thread(FROM_HERE, Bind(&bta_jv_l2cap_write, handle, req_id, p_data, len, user_id, &bta_jv_cb.l2c_cb[handle])); Loading @@ -532,7 +535,8 @@ tBTA_JV_STATUS BTA_JvL2capWrite(uint32_t handle, uint32_t req_id, * Description This function writes data to an L2CAP connection * When the operation is complete, tBTA_JV_L2CAP_CBACK is * called with BTA_JV_L2CAP_WRITE_EVT. Works for * fixed-channel connections * fixed-channel connections. This function takes ownership of * p_data, and will osi_free it. * * Returns BTA_JV_SUCCESS, if the request is being processed. * BTA_JV_FAILURE, otherwise. Loading system/btif/src/btif_sock_l2cap.cc +9 −20 Original line number Diff line number Diff line Loading @@ -627,11 +627,7 @@ static void on_l2cap_outgoing_congest(tBTA_JV_L2CAP_CONG* p, uint32_t id) { } } static void on_l2cap_write_done(void* req_id, uint16_t len, uint32_t id) { if (req_id != NULL) { osi_free(req_id); // free the buffer } static void on_l2cap_write_done(uint16_t len, uint32_t id) { std::unique_lock<std::mutex> lock(state_lock); l2cap_socket* sock = btsock_l2cap_find_by_id_l(id); if (!sock) return; Loading Loading @@ -735,14 +731,12 @@ static void btsock_l2cap_cbk(tBTA_JV_EVT event, tBTA_JV* p_data, case BTA_JV_L2CAP_WRITE_EVT: APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_EVT: id: %u", l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write.p_data, p_data->l2c_write.len, l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write.len, l2cap_socket_id); break; case BTA_JV_L2CAP_WRITE_FIXED_EVT: APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_FIXED_EVT: id: %u", l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write_fixed.p_data, p_data->l2c_write.len, l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write.len, l2cap_socket_id); break; case BTA_JV_L2CAP_CONG_EVT: Loading Loading @@ -1002,18 +996,13 @@ void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id) { DVLOG(2) << __func__ << ": bytes received from socket: " << count; if (sock->fixed_chan) { if (BTA_JvL2capWriteFixed(sock->channel, sock->addr, PTR_TO_UINT(buffer), btsock_l2cap_cbk, buffer, count, user_id) != BTA_JV_SUCCESS) { // On fail, free the buffer on_l2cap_write_done(buffer, count, user_id); } // will take care of freeing buffer BTA_JvL2capWriteFixed(sock->channel, sock->addr, PTR_TO_UINT(buffer), btsock_l2cap_cbk, buffer, count, user_id); } else { if (BTA_JvL2capWrite(sock->handle, PTR_TO_UINT(buffer), buffer, count, user_id) != BTA_JV_SUCCESS) { // On fail, free the buffer on_l2cap_write_done(buffer, count, user_id); } // will take care of freeing buffer BTA_JvL2capWrite(sock->handle, PTR_TO_UINT(buffer), buffer, count, user_id); } } } else Loading Loading
system/bta/include/bta_jv_api.h +0 −2 Original line number Diff line number Diff line Loading @@ -246,7 +246,6 @@ typedef struct { uint32_t handle; /* The connection handle */ uint32_t req_id; /* The req_id in the associated BTA_JvL2capWrite() */ uint16_t len; /* The length of the data written. */ uint8_t* p_data; /* The buffer where data is held */ bool cong; /* congestion status */ } tBTA_JV_L2CAP_WRITE; Loading @@ -256,7 +255,6 @@ typedef struct { uint16_t channel; /* The connection channel */ RawAddress addr; /* The peer address */ uint32_t req_id; /* The req_id in the associated BTA_JvL2capWrite() */ uint8_t* p_data; /* The buffer where data is held */ uint16_t len; /* The length of the data written. */ bool cong; /* congestion status */ } tBTA_JV_L2CAP_WRITE_FIXED; Loading
system/bta/jv/bta_jv_act.cc +6 −2 Original line number Diff line number Diff line Loading @@ -1154,6 +1154,7 @@ void bta_jv_l2cap_write(uint32_t handle, uint32_t req_id, uint8_t* p_data, * channel is disconnected after the API function is called, but before the * message is handled. */ LOG(ERROR) << __func__ << ": p_cb->p_cback == NULL"; osi_free(p_data); return; } Loading @@ -1161,7 +1162,6 @@ void bta_jv_l2cap_write(uint32_t handle, uint32_t req_id, uint8_t* p_data, evt_data.status = BTA_JV_FAILURE; evt_data.handle = handle; evt_data.req_id = req_id; evt_data.p_data = p_data; evt_data.cong = p_cb->cong; evt_data.len = 0; bta_jv_pm_conn_busy(p_cb->p_pm_cb); Loading @@ -1169,6 +1169,9 @@ void bta_jv_l2cap_write(uint32_t handle, uint32_t req_id, uint8_t* p_data, BT_PASS == GAP_ConnWriteData(handle, p_data, len, &evt_data.len)) { evt_data.status = BTA_JV_SUCCESS; } osi_free(p_data); tBTA_JV bta_jv; bta_jv.l2c_write = evt_data; p_cb->p_cback(BTA_JV_L2CAP_WRITE_EVT, &bta_jv, user_id); Loading @@ -1183,7 +1186,6 @@ void bta_jv_l2cap_write_fixed(uint16_t channel, const RawAddress& addr, evt_data.channel = channel; evt_data.addr = addr; evt_data.req_id = req_id; evt_data.p_data = p_data; evt_data.len = 0; BT_HDR* msg = (BT_HDR*)osi_malloc(sizeof(BT_HDR) + len + L2CAP_MIN_OFFSET); Loading @@ -1191,6 +1193,8 @@ void bta_jv_l2cap_write_fixed(uint16_t channel, const RawAddress& addr, msg->len = len; msg->offset = L2CAP_MIN_OFFSET; osi_free(p_data); L2CA_SendFixedChnlData(channel, addr, msg); tBTA_JV bta_jv; Loading
system/bta/jv/bta_jv_api.cc +7 −3 Original line number Diff line number Diff line Loading @@ -506,7 +506,8 @@ tBTA_JV_STATUS BTA_JvL2capReady(uint32_t handle, uint32_t* p_data_size) { * Description This function writes data to an L2CAP connection * When the operation is complete, tBTA_JV_L2CAP_CBACK is * called with BTA_JV_L2CAP_WRITE_EVT. Works for * PSM-based connections * PSM-based connections. This function takes ownership of * p_data, and will osi_free it. * * Returns BTA_JV_SUCCESS, if the request is being processed. * BTA_JV_FAILURE, otherwise. Loading @@ -517,8 +518,10 @@ tBTA_JV_STATUS BTA_JvL2capWrite(uint32_t handle, uint32_t req_id, uint32_t user_id) { VLOG(2) << __func__; if (handle >= BTA_JV_MAX_L2C_CONN || !bta_jv_cb.l2c_cb[handle].p_cback) if (handle >= BTA_JV_MAX_L2C_CONN || !bta_jv_cb.l2c_cb[handle].p_cback) { osi_free(p_data); return BTA_JV_FAILURE; } do_in_bta_thread(FROM_HERE, Bind(&bta_jv_l2cap_write, handle, req_id, p_data, len, user_id, &bta_jv_cb.l2c_cb[handle])); Loading @@ -532,7 +535,8 @@ tBTA_JV_STATUS BTA_JvL2capWrite(uint32_t handle, uint32_t req_id, * Description This function writes data to an L2CAP connection * When the operation is complete, tBTA_JV_L2CAP_CBACK is * called with BTA_JV_L2CAP_WRITE_EVT. Works for * fixed-channel connections * fixed-channel connections. This function takes ownership of * p_data, and will osi_free it. * * Returns BTA_JV_SUCCESS, if the request is being processed. * BTA_JV_FAILURE, otherwise. Loading
system/btif/src/btif_sock_l2cap.cc +9 −20 Original line number Diff line number Diff line Loading @@ -627,11 +627,7 @@ static void on_l2cap_outgoing_congest(tBTA_JV_L2CAP_CONG* p, uint32_t id) { } } static void on_l2cap_write_done(void* req_id, uint16_t len, uint32_t id) { if (req_id != NULL) { osi_free(req_id); // free the buffer } static void on_l2cap_write_done(uint16_t len, uint32_t id) { std::unique_lock<std::mutex> lock(state_lock); l2cap_socket* sock = btsock_l2cap_find_by_id_l(id); if (!sock) return; Loading Loading @@ -735,14 +731,12 @@ static void btsock_l2cap_cbk(tBTA_JV_EVT event, tBTA_JV* p_data, case BTA_JV_L2CAP_WRITE_EVT: APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_EVT: id: %u", l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write.p_data, p_data->l2c_write.len, l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write.len, l2cap_socket_id); break; case BTA_JV_L2CAP_WRITE_FIXED_EVT: APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_FIXED_EVT: id: %u", l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write_fixed.p_data, p_data->l2c_write.len, l2cap_socket_id); on_l2cap_write_done(p_data->l2c_write.len, l2cap_socket_id); break; case BTA_JV_L2CAP_CONG_EVT: Loading Loading @@ -1002,18 +996,13 @@ void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id) { DVLOG(2) << __func__ << ": bytes received from socket: " << count; if (sock->fixed_chan) { if (BTA_JvL2capWriteFixed(sock->channel, sock->addr, PTR_TO_UINT(buffer), btsock_l2cap_cbk, buffer, count, user_id) != BTA_JV_SUCCESS) { // On fail, free the buffer on_l2cap_write_done(buffer, count, user_id); } // will take care of freeing buffer BTA_JvL2capWriteFixed(sock->channel, sock->addr, PTR_TO_UINT(buffer), btsock_l2cap_cbk, buffer, count, user_id); } else { if (BTA_JvL2capWrite(sock->handle, PTR_TO_UINT(buffer), buffer, count, user_id) != BTA_JV_SUCCESS) { // On fail, free the buffer on_l2cap_write_done(buffer, count, user_id); } // will take care of freeing buffer BTA_JvL2capWrite(sock->handle, PTR_TO_UINT(buffer), buffer, count, user_id); } } } else Loading