Index: device/bluetooth/bluetooth_low_energy_device_mac.mm |
diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.mm b/device/bluetooth/bluetooth_low_energy_device_mac.mm |
index b5777bed5d8de949320ac3022b50065c2ec2c682..3bd2dc62692591d2793220fa405e3d6641ab2475 100644 |
--- a/device/bluetooth/bluetooth_low_energy_device_mac.mm |
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm |
@@ -254,6 +254,13 @@ void BluetoothLowEnergyDeviceMac::DidDiscoverCharacteristics( |
// Don't create characteristics if the device disconnected. |
return; |
} |
+ if (IsGattServicesDiscoveryComplete()) { |
+ // This should never happens, just in case it happens with a device, |
scheib
2017/04/18 04:43:21
"never happen"
jlebel
2017/04/29 22:08:07
Done.
|
+ // this notification should be ignored. |
+ VLOG(1) << *this |
+ << ": Discovery complete, ignoring DidDiscoverCharacteristics."; |
+ return; |
+ } |
BluetoothRemoteGattServiceMac* gatt_service = |
GetBluetoothRemoteGattService(cb_service); |
@@ -325,6 +332,13 @@ void BluetoothLowEnergyDeviceMac::DidDiscoverDescriptors( |
// Don't discover descriptors if the device disconnected. |
return; |
} |
+ if (IsGattServicesDiscoveryComplete()) { |
+ // This should never happens, just in case it happens with a device, |
scheib
2017/04/18 04:43:21
ditto
jlebel
2017/04/29 22:08:07
Done.
|
+ // this notification should be ignored. |
+ VLOG(1) << *this |
+ << ": Discovery complete, ignoring DidDiscoverDescriptors."; |
+ return; |
+ } |
BluetoothRemoteGattServiceMac* gatt_service = |
GetBluetoothRemoteGattService(cb_characteristic.service); |
DCHECK(gatt_service); |
@@ -360,6 +374,7 @@ void BluetoothLowEnergyDeviceMac::DiscoverPrimaryServices() { |
} |
void BluetoothLowEnergyDeviceMac::SendNotificationIfDiscoveryComplete() { |
+ DCHECK(!IsGattServicesDiscoveryComplete()); |
// Notify when all services have been discovered. |
bool discovery_complete = |
discovery_pending_count_ == 0 && |