Bluetooth: host: Don't send slave conn param request if not needed

If master or application decided to switch connection parameters to
ones that meet pending parameters don't bother sending request
after 5 seconds timeout.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
Szymon Janc 2018-11-14 13:21:37 +01:00 committed by Johan Hedberg
commit bf71fa1aeb

View file

@ -153,6 +153,17 @@ void notify_le_param_updated(struct bt_conn *conn)
{
struct bt_conn_cb *cb;
/* If new connection parameters meet requirement of pending
* parameters don't send slave conn param request anymore on timeout
*/
if (atomic_test_bit(conn->flags, BT_CONN_SLAVE_PARAM_SET) &&
conn->le.interval >= conn->le.interval_min &&
conn->le.interval <= conn->le.interval_max &&
conn->le.latency == conn->le.pending_latency &&
conn->le.timeout == conn->le.pending_timeout) {
atomic_clear_bit(conn->flags, BT_CONN_SLAVE_PARAM_SET);
}
for (cb = callback_list; cb; cb = cb->_next) {
if (cb->le_param_updated) {
cb->le_param_updated(conn, conn->le.interval,
@ -1811,6 +1822,7 @@ int bt_conn_le_param_update(struct bt_conn *conn,
conn->le.interval <= param->interval_max &&
conn->le.latency == param->latency &&
conn->le.timeout == param->timeout) {
atomic_clear_bit(conn->flags, BT_CONN_SLAVE_PARAM_SET);
return -EALREADY;
}