New issue
Advanced search Search tips

Issue 690204 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 697246


Show other hotlists

Hotlists containing this issue:
web-bluetooth


Sign in to add a comment

bluetooth: mac: Getting DidModifyServices while scanning

Project Member Reported by jlebel@chromium.org, Feb 8 2017

Issue description

Right now, if DidModifyServices notification happens while a scanning is in process, a second scanning will be starting, DCHECK(!is_discovery_complete_); in BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() or in BluetoothRemoteGattCharacteristicMac::DidDiscoverDescriptors() should fail.

A counter is needed in those methods to keep track of the discovery being started.

The scenario should be:
* Device: DidModifyServices notification
    - Chrome: Scan for primary services
* Device: DidDiscoverServices
    - Chrome: Scan for characteristics
* Device: DidModifyServices notification <= second discovery started
    - Chrome: Scan for primary services
* Device: DidDiscoverCharacteristics
* Device: DidDiscoverServices
    - Chrome: Scan for characteristics
* Device: DidDiscoverCharacteristics
    - Chrome: Scan for descriptors
* Device: DidDiscoverDescriptors
    - Chrome: DiscoveryComplete notification

or
* Device: DidModifyServices notification
    - Chrome: Scan for primary services
* Device: DidDiscoverServices
    - Chrome: Scan for characteristics
* Device: DidDiscoverCharacteristics
    - Chrome: Scan for descriptors
* Device: DidModifyServices notification <= second discovery started
    - Chrome: Scan for primary services
* Device: DidDiscoverDescriptors
    - Chrome: Scan for primary services
* Device: DidDiscoverServices
    - Chrome: Scan for characteristics
* Device: DidDiscoverCharacteristics
    - Chrome: Scan for descriptors
* Device: DidDiscoverDescriptors
    - Chrome: DiscoveryComplete notification

 
Blockedon: 697246
Status: Started (was: Assigned)
Summary: bluetooth: mac: Getting DidModifyServices while scanning (was: bluetooth: macOS: Getting DidModifyServices while scanning)
Cc: jlebel@chromium.org
 Issue 707601  has been merged into this issue.
Project Member

Comment 5 by bugdroid1@chromium.org, May 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/74fe98e203e687c3c96f25128fc55e94981465a7

commit 74fe98e203e687c3c96f25128fc55e94981465a7
Author: jlebel <jlebel@chromium.org>
Date: Thu May 04 20:45:17 2017

Bluetooth: macOS: DidModifyServices can happens while scanning

This patch is to fix this scenario:
* Device: DidModifyServices notification
    - Chrome: Scan for primary services
* Device: DidDiscoverServices
    - Chrome: Scan for characteristics
* Device: DidModifyServices notification
    - Chrome: Scan for primary services
* Device: DidDiscoverCharacteristics
* Device: DidDiscoverServices
    - Chrome: Scan for characteristics
* Device: DidDiscoverCharacteristics

We need to wait until all the pending characteristic discoveries are done until we can start scanning
for descriptors. We need to make sure descriptors are not ready if DidModifyServices notification
is received while scanning for descriptors.

Adding discovery_pending_count_ in BluetoothRemoteGattServiceMac and BluetoothRemoteGattCharacteristicMac.
|is_discovery_complete_| can be set to true when discovery_pending_count_ is equal to 0.

BUG= 690204 

Review-Url: https://codereview.chromium.org/2638653002
Cr-Commit-Position: refs/heads/master@{#469457}

[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_device_unittest.cc
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_low_energy_device_mac.mm
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_remote_gatt_service_mac.h
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_remote_gatt_service_mac.mm
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/bluetooth_remote_gatt_service_unittest.cc
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/test/bluetooth_test_mac.h
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/test/bluetooth_test_mac.mm
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h
[modify] https://crrev.com/74fe98e203e687c3c96f25128fc55e94981465a7/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm

Status: Fixed (was: Started)

Sign in to add a comment