mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Internal change
PiperOrigin-RevId: 364353126
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "platform/api/bluetooth_classic.h"
|
||||
#include "platform/base/cancellation_flag_listener.h"
|
||||
#include "platform/base/logging.h"
|
||||
#include "platform/base/medium_environment.h"
|
||||
#include "platform/impl/g3/bluetooth_adapter.h"
|
||||
@@ -234,6 +235,11 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
|
||||
return {};
|
||||
}
|
||||
|
||||
CancellationFlagListener listener(cancellation_flag, [&server_socket]() {
|
||||
NEARBY_LOGS(INFO) << "G3 Bluetooth Cancel Connect.";
|
||||
if (server_socket != nullptr) server_socket->Close();
|
||||
});
|
||||
|
||||
auto socket = std::make_unique<BluetoothSocket>(&GetAdapter());
|
||||
// Finally, Request to connect to this socket.
|
||||
if (!server_socket->Connect(*socket)) {
|
||||
|
||||
Reference in New Issue
Block a user