Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 954a2497 authored by Nitin Arora's avatar Nitin Arora Committed by Andre Eisenbach
Browse files

Fix allocation of instance ID for LE services

Defers the incrementing of the total services count after the allocation
of the instance ID for the service. If the increment is not deferred,
the current service is compared with its own instance in the cached
service list while allocating the instance ID. This leads to an
incorrect instance ID being allocated for the service.

Change-Id: I547888ae0f7015cfdb9b1a995373523699642a6c
parent a4dc5bf8
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -746,10 +746,8 @@ static tBTA_GATT_STATUS bta_gattc_add_srvc_to_list(tBTA_GATTC_SERV *p_srvc_cb,
    {
        p_rec = p_srvc_cb->p_srvc_list + p_srvc_cb->next_avail_idx;

        p_srvc_cb->total_srvc ++;

        APPL_TRACE_DEBUG("bta_gattc_add_srvc_to_list handle = %d, service type = 0x%04x",
            s_handle, uuid.uu.uuid16);
        APPL_TRACE_DEBUG("%s handle=%d, service type=0x%04x",
                            __func__, s_handle, uuid.uu.uuid16);

        p_rec->s_handle     = s_handle;
        p_rec->e_handle     = e_handle;
@@ -757,8 +755,8 @@ static tBTA_GATT_STATUS bta_gattc_add_srvc_to_list(tBTA_GATTC_SERV *p_srvc_cb,
        p_rec->srvc_inst_id = bta_gattc_get_srvc_inst_id(p_srvc_cb, uuid);
        memcpy(&p_rec->uuid, &uuid, sizeof(tBT_UUID));

        p_srvc_cb->total_srvc ++;
        p_srvc_cb->next_avail_idx ++;

    }
    else
    {   /* allocate bigger buffer ?? */