Fixed crash during BT connection

PiperOrigin-RevId: 527656444
This commit is contained in:
Guogang Li
2023-04-27 12:47:36 -07:00
committed by Copybara-Service
parent 83739b3185
commit 4b27e8c446
3 changed files with 0 additions and 9 deletions
@@ -310,7 +310,6 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
}
nearby::CancellationFlagListener cancellation_flag_listener(
cancellation_flag, [&rfcomm_socket]() {
rfcomm_socket->CancelIOAsync().get();
rfcomm_socket->Close();
});
@@ -195,12 +195,6 @@ ExceptionOr<ByteArray> BluetoothSocket::BluetoothInputStream::Read(
}
}
IAsyncAction BluetoothSocket::CancelIOAsync() {
// Cancels pending reads and writes over a StreamSocket object.
// https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamsocket.cancelioasync?view=winrt-20348
return windows_socket_.CancelIOAsync();
}
Exception BluetoothSocket::BluetoothInputStream::Close() {
NEARBY_LOGS(INFO) << __func__ << ": Close bluetooth input stream.";
@@ -98,8 +98,6 @@ class BluetoothSocket : public api::BluetoothSocket {
bool Connect(HostName connectionHostName,
winrt::hstring connectionServiceName);
IAsyncAction CancelIOAsync();
private:
static constexpr int kInitialTransmitPacketSize = 4096;