Bluetooth: ATT: call-back on buffer destroy
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>
This commit is contained in:
parent
a05a47573a
commit
b83b9bede3
3 changed files with 101 additions and 154 deletions
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue