gatt: added missing disconn_id's and removed extra check
authorBernie Conrad <bernie@allthenticate.com>
Tue, 12 Oct 2021 21:51:51 +0000 (14:51 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:37 +0000 (19:08 +0530)
Adds missing assignment to disconn_id for pending operations and removes
check that is already handled by checking if the owner_queue of the op
is gone at the start of write_reply_cb.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/gatt-database.c

index 084d33d..af8c7f3 100644 (file)
@@ -1126,7 +1126,7 @@ static struct pending_op *pending_ccc_new(struct bt_att *att,
        op->attrib = attrib;
        op->link_type = link_type;
 
-       bt_att_register_disconnect(att,
+       op->disconn_id = bt_att_register_disconnect(att,
                                   pending_disconnect_cb,
                                   op,
                                   NULL);
@@ -2864,9 +2864,7 @@ static void write_reply_cb(DBusMessage *message, void *user_data)
        }
 
 done:
-       /* Make sure that only reply if the device is connected */
-       if (!bt_att_get_fd(op->att))
-               gatt_db_attribute_write_result(op->attrib, op->id, ecode);
+       gatt_db_attribute_write_result(op->attrib, op->id, ecode);
 }
 
 static struct pending_op *pending_write_new(struct bt_att *att,
@@ -2901,7 +2899,7 @@ static struct pending_op *pending_write_new(struct bt_att *att,
        op->prep_authorize = prep_authorize;
        queue_push_tail(owner_queue, op);
 
-       bt_att_register_disconnect(att,
+       op->disconn_id = bt_att_register_disconnect(att,
                                pending_disconnect_cb,
                                op, NULL);
        return op;