Skip to content

Commit e494d9c

Browse files
hermabecarlescufi
authored andcommitted
Bluetooth: Host: Handle err in l2cap_chan_sdu_sent and l2cap_chan_seg_sent
The error will be propagated to the higher levels. Signed-off-by: Herman Berget <[email protected]>
1 parent eff1066 commit e494d9c

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

subsys/bluetooth/host/l2cap.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,22 +1849,28 @@ static void l2cap_chan_sdu_sent(struct bt_conn *conn, void *user_data, int err)
18491849
{
18501850
struct l2cap_tx_meta_data *data = user_data;
18511851
struct bt_l2cap_chan *chan;
1852-
bt_conn_tx_cb_t cb;
1853-
void *cb_user_data;
1852+
bt_conn_tx_cb_t cb = data->cb;
1853+
void *cb_user_data = data->user_data;
1854+
uint16_t cid = data->cid;
18541855

1855-
BT_DBG("conn %p CID 0x%04x", conn, data->cid);
1856+
BT_DBG("conn %p CID 0x%04x err %d", conn, cid, err);
18561857

1857-
chan = bt_l2cap_le_lookup_tx_cid(conn, data->cid);
1858+
free_tx_meta_data(data);
1859+
1860+
if (err) {
1861+
if (cb) {
1862+
cb(conn, cb_user_data, err);
1863+
}
1864+
1865+
return;
1866+
}
1867+
1868+
chan = bt_l2cap_le_lookup_tx_cid(conn, cid);
18581869
if (!chan) {
18591870
/* Received SDU sent callback for disconnected channel */
18601871
return;
18611872
}
18621873

1863-
cb = data->cb;
1864-
cb_user_data = data->user_data;
1865-
1866-
free_tx_meta_data(data);
1867-
18681874
if (chan->ops->sent) {
18691875
chan->ops->sent(chan);
18701876
}
@@ -1881,7 +1887,11 @@ static void l2cap_chan_seg_sent(struct bt_conn *conn, void *user_data, int err)
18811887
struct l2cap_tx_meta_data *data = user_data;
18821888
struct bt_l2cap_chan *chan;
18831889

1884-
BT_DBG("conn %p CID 0x%04x", conn, data->cid);
1890+
BT_DBG("conn %p CID 0x%04x err %d", conn, data->cid, err);
1891+
1892+
if (err) {
1893+
return;
1894+
}
18851895

18861896
chan = bt_l2cap_le_lookup_tx_cid(conn, data->cid);
18871897
if (!chan) {

0 commit comments

Comments
 (0)