if (written != length) {
att_result = BLUETOOTH_ERROR_INTERNAL;
BT_ERR("write data failed. ret : %d ", written);
+ if (TIZEN_FEATURE_DA_REFERENCE) {
+ /* If bluetooth_gatt_client_write_channel_watch_cb() is not called
+ * due to a server issue and write request fails,
+ * remove the existing fd from the list and reallocate it.*/
+ GSList *l;
+ for (l = gatt_characteristic_write_list; l != NULL; l = l->next) {
+ bt_gatt_characteristic_write_info_t *info = l->data;
+ if (!info)
+ continue;
+ if (info->write_fd == fd) {
+ gatt_characteristic_write_list = g_slist_remove(gatt_characteristic_write_list, info);
+ break;
+ }
+ }
+ }
}
return att_result;