• jlebel's avatar
    Bluetooth: macOS: DidModifyServices can happens while scanning · 74fe98e2
    jlebel authored
    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}
    74fe98e2
mock_bluetooth_cbperipheral_mac.h 1.98 KB