diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2017-07-25 14:56:07 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2017-07-25 14:56:07 +0300 |
commit | 95749eef62c768eb0f5a0e61654a093264513ded (patch) | |
tree | 25ca9936696ddb0015848d00df5342b743f1770e /src/gatt-client.c | |
parent | 3790a1f46ce0105308a45b4dbb9ca769828fa81d (diff) | |
download | bluez-95749eef62c768eb0f5a0e61654a093264513ded.tar.gz |
gatt: Disconnect IO if the device is disconnected
Don't persist the IO accross connections, the application should
reacquire once the device reconnects.
Diffstat (limited to 'src/gatt-client.c')
-rw-r--r-- | src/gatt-client.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gatt-client.c b/src/gatt-client.c index 4f70aa7db..1cd7fbcf5 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -65,6 +65,7 @@ struct btd_gatt_client { struct queue *services; struct queue *all_notify_clients; + struct queue *ios; }; struct service { @@ -1169,6 +1170,8 @@ static DBusMessage *characteristic_create_pipe(struct characteristic *chrc, "NotifyAcquired"); } + queue_push_tail(chrc->service->client->ios, io); + DBG("%s: sender %s io %p", dbus_message_get_member(msg), dbus_message_get_sender(msg), io); @@ -2063,6 +2066,7 @@ struct btd_gatt_client *btd_gatt_client_new(struct btd_device *device) client = new0(struct btd_gatt_client, 1); client->services = queue_new(); client->all_notify_clients = queue_new(); + client->ios = queue_new(); client->device = device; ba2str(device_get_address(device), client->devaddr); @@ -2078,6 +2082,7 @@ void btd_gatt_client_destroy(struct btd_gatt_client *client) queue_destroy(client->services, unregister_service); queue_destroy(client->all_notify_clients, NULL); + queue_destroy(client->ios, NULL); bt_gatt_client_unref(client->gatt); gatt_db_unref(client->db); free(client); @@ -2199,6 +2204,9 @@ void btd_gatt_client_disconnected(struct btd_gatt_client *client) DBG("Device disconnected. Cleaning up."); + queue_remove_all(client->ios, NULL, NULL, + (queue_destroy_func_t) io_shutdown); + /* * TODO: Once GATT over BR/EDR is properly supported, we should pass the * correct bdaddr_type based on the transport over which GATT is being |