Skip to content

Commit

Permalink
Bluetooth: ATT: call-back on buffer destroy
Browse files Browse the repository at this point in the history
This is just as arbitrary as what was before, but simpler.

Before this change, the callback were invoked upon receiving the num
complete packets event.
This did not necessarily work with all spec-compliant controllers.

Now the callback is invoked as soon as the lower layer destroys the
buffer. ATT shouldn't care whether L2CAP sends it over RFC1149 or
something else after that point.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
  • Loading branch information
2 people authored and jhedberg committed Dec 15, 2023
1 parent a05a475 commit b83b9be
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 149 deletions.
5 changes: 5 additions & 0 deletions samples/bluetooth/central_gatt_write/src/gatt_write_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ static void write_cmd_cb(struct bt_conn *conn, void *user_data)
delta = k_cycle_get_32() - cycle_stamp;
delta = k_cyc_to_ns_floor64(delta);

if (delta == 0) {
/* Skip division by zero */
return;
}

/* if last data rx-ed was greater than 1 second in the past,
* reset the metrics.
*/
Expand Down
Loading

0 comments on commit b83b9be

Please sign in to comment.