diff --git a/src/shared/att.c b/src/shared/att.c
index 0d27dfa..6f5e405 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
struct bt_att {
int ref_count;
int fd;
- bool close_on_unref;
struct io *io;
bool invalid; /* bt_att becomes invalid when a request times out */
io_destroy(att->io);
att->io = NULL;
- if (att->close_on_unref)
- close(att->fd);
-
if (att->timeout_destroy)
att->timeout_destroy(att->timeout_data);
if (!att)
return false;
- att->close_on_unref = do_close;
-
- return true;
+ return io_set_close_on_destroy(att->io, do_close);
}
bool bt_att_set_debug(struct bt_att *att, bt_att_debug_func_t callback,