Skip to content

Commit 3e56b12

Browse files
jori-nordicfabiobaltieri
authored andcommitted
Bluetooth: ATT: don't access l2cap ops struct
It's bad form, especially since in that case, it's always the same function that is called `bt_att_sent()`. Signed-off-by: Jonathan Rico <[email protected]>
1 parent ffc4251 commit 3e56b12

File tree

1 file changed

+11
-3
lines changed
  • subsys/bluetooth/host

1 file changed

+11
-3
lines changed

subsys/bluetooth/host/att.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,25 @@ static void bt_att_disconnected(struct bt_l2cap_chan *chan);
212212
struct net_buf *bt_att_create_rsp_pdu(struct bt_att_chan *chan,
213213
uint8_t op, size_t len);
214214

215+
static void bt_att_sent(struct bt_l2cap_chan *ch);
216+
215217
void att_sent(struct bt_conn *conn, void *user_data)
216218
{
217219
struct bt_att_tx_meta_data *data = user_data;
218220
struct bt_att_chan *att_chan = data->att_chan;
219221
struct bt_l2cap_chan *chan = &att_chan->chan.chan;
220222

223+
__ASSERT_NO_MSG(!bt_att_is_enhanced(att_chan));
224+
221225
LOG_DBG("conn %p chan %p", conn, chan);
222226

223-
if (chan->ops->sent) {
224-
chan->ops->sent(chan);
225-
}
227+
/* For EATT, `bt_att_sent` is assigned to the `.sent` L2 callback.
228+
* L2CAP will then call it once the SDU has finished sending.
229+
*
230+
* For UATT, this won't happen, as static LE l2cap channels don't have
231+
* SDUs. Call it manually instead.
232+
*/
233+
bt_att_sent(chan);
226234
}
227235

228236
static int att_chan_send_cb(struct bt_att_chan *att_chan,

0 commit comments

Comments
 (0)