Chromium Code Reviews| Index: chromeos/components/tether/ble_connection_manager.cc |
| diff --git a/chromeos/components/tether/ble_connection_manager.cc b/chromeos/components/tether/ble_connection_manager.cc |
| index b4860790fab1d11a1c24be2a5e6bbc61ff2a2715..a4a9d5a295146f443281ed404afeb084698b3bea 100644 |
| --- a/chromeos/components/tether/ble_connection_manager.cc |
| +++ b/chromeos/components/tether/ble_connection_manager.cc |
| @@ -101,6 +101,10 @@ void BleConnectionManager::ConnectionMetadata::OnConnectionAttemptTimeout() { |
| manager_->OnConnectionAttemptTimeout(remote_device_); |
| } |
| +bool BleConnectionManager::ConnectionMetadata::HasSecureChannel() { |
| + return secure_channel_ != nullptr; |
| +} |
| + |
| void BleConnectionManager::ConnectionMetadata::SetSecureChannel( |
| std::unique_ptr<cryptauth::SecureChannel> secure_channel) { |
| DCHECK(!secure_channel_); |
| @@ -318,6 +322,14 @@ void BleConnectionManager::OnReceivedAdvertisementFromDevice( |
| return; |
| } |
| + if (connection_metadata->HasSecureChannel()) { |
| + PA_LOG(WARNING) << "Received another advertisement from a registered " |
| + << "device which is already being actively communicated " |
| + << "with. Bluetooth address: " << device_address |
| + << ", Remote Device ID: " << remote_device.GetDeviceId(); |
|
Kyle Horimoto
2017/04/06 21:17:30
Truncate the device ID.
Ryan Hansberry
2017/04/06 22:14:59
Done for here and the log above as well.
|
| + return; |
| + } |
| + |
| PA_LOG(INFO) << "Received advertisement from device with ID " |
| << remote_device.GetTruncatedDeviceIdForLogs() << ". " |
| << "Starting authentication handshake to that device."; |