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

Unified Diff: chromeos/components/tether/ble_connection_manager.cc

Issue 2804123002: BleConnectionManager: Check when receiving BLE advertisements if a SecureChannel already exists. No… (Closed)
Patch Set: 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: 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.";

Powered by Google App Engine
This is Rietveld 408576698