Skip to content

Commit

Permalink
[nrf noup] bluetooth: conn: Allow for an extra ref in bt_conn_send_cb
Browse files Browse the repository at this point in the history
Allow for an additional buffer reference if callback is provided. This
can be used to extend lifetime of the net buffer until the data
transmission is confirmed by ACK of the remote.

Jira: NCSDK-27422

Signed-off-by: Marek Pieta <[email protected]>
  • Loading branch information
MarekPieta authored and anangl committed Jun 18, 2024
1 parent ff5a2d9 commit c735ea2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion subsys/bluetooth/host/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,11 @@ int bt_conn_send_cb(struct bt_conn *conn, struct net_buf *buf,
LOG_DBG("conn handle %u buf len %u cb %p user_data %p", conn->handle, buf->len, cb,
user_data);

if (buf->ref != 1) {
/* Allow for an additional buffer reference if callback is provided. This can be used to
* extend lifetime of the net buffer until the data transmission is confirmed by ACK of the
* remote.
*/
if (buf->ref > 1 + (cb ? 1 : 0)) {
/* The host may alter the buf contents when fragmenting. Higher
* layers cannot expect the buf contents to stay intact. Extra
* refs suggests a silent data corruption would occur if not for
Expand Down

0 comments on commit c735ea2

Please sign in to comment.