mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Merge branch 'google3' to roll forward up to cl/351408510.
This commit is contained in:
@@ -346,6 +346,18 @@ bool BluetoothClassic::StopAcceptingConnections(
|
||||
|
||||
BluetoothSocket BluetoothClassic::Connect(BluetoothDevice& bluetooth_device,
|
||||
const std::string& service_name) {
|
||||
for (int attempts_count = 0; attempts_count < kConnectAttemptsLimit;
|
||||
attempts_count++) {
|
||||
auto wrapper_result = AttemptToConnect(bluetooth_device, service_name);
|
||||
if (wrapper_result.IsValid()) {
|
||||
return wrapper_result;
|
||||
}
|
||||
}
|
||||
return BluetoothSocket();
|
||||
}
|
||||
|
||||
BluetoothSocket BluetoothClassic::AttemptToConnect(
|
||||
BluetoothDevice& bluetooth_device, const std::string& service_name) {
|
||||
MutexLock lock(&mutex_);
|
||||
NEARBY_LOG(INFO, "BluetoothClassic::Connect: device=%p", &bluetooth_device);
|
||||
// Socket to return. To allow for NRVO to work, it has to be a single object.
|
||||
|
||||
Reference in New Issue
Block a user