mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 07:06:11 -04:00
Improve device lost handling
Handle the error case when the platform calls device_lost_cb without calling device_discovered_cb first. PiperOrigin-RevId: 539791976
This commit is contained in:
committed by
Copybara-Service
parent
6f69e97421
commit
4f73e87a6f
@@ -73,6 +73,11 @@ bool BluetoothClassicMedium::StartDiscovery(DiscoveryCallback callback) {
|
||||
[this](api::BluetoothDevice& device) {
|
||||
MutexLock lock(&mutex_);
|
||||
auto item = devices_.extract(&device);
|
||||
if (!item) {
|
||||
NEARBY_LOGS(WARNING)
|
||||
<< "Removing unknown device: " << device.GetMacAddress();
|
||||
return;
|
||||
}
|
||||
auto& context = *item.mapped();
|
||||
NEARBY_LOG(INFO, "Removing device=%p, impl=%p", &context.device,
|
||||
&device);
|
||||
|
||||
Reference in New Issue
Block a user