Bluetooth: GATT: Provide correct error code when disconnected
Calling indicate or notify on a disconnected connection object would result in the error code ENOMEM when failing to acquire buffers instead of the expected return code ENOTCONN. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
e11248baa6
commit
8b976b12a8
1 changed files with 8 additions and 0 deletions
|
@ -1586,6 +1586,10 @@ int bt_gatt_notify_cb(struct bt_conn *conn,
|
|||
|
||||
attr = params->attr;
|
||||
|
||||
if (conn && conn->state != BT_CONN_CONNECTED) {
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
handle = attr->handle ? : find_static_attr(attr);
|
||||
if (!handle) {
|
||||
return -ENOENT;
|
||||
|
@ -1644,6 +1648,10 @@ int bt_gatt_indicate(struct bt_conn *conn,
|
|||
|
||||
attr = params->attr;
|
||||
|
||||
if (conn && conn->state != BT_CONN_CONNECTED) {
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
handle = attr->handle ? : find_static_attr(attr);
|
||||
if (!handle) {
|
||||
return -ENOENT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue