Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

Issue 2638653002: Bluetooth: macOS: DidModifyServices can happens while scanning (Closed)
Patch Set: More unit tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 &&

Powered by Google App Engine
This is Rietveld 408576698