Enhance on Bluetooth discovery check

PiperOrigin-RevId: 691947459
This commit is contained in:
Guogang Li
2024-10-31 15:05:16 -07:00
committed by Copybara-Service
parent 7f7dee54c0
commit f391af8e47
7 changed files with 45 additions and 19 deletions
@@ -31,6 +31,7 @@
#include "internal/platform/cancelable_alarm.h"
#include "internal/platform/exception.h"
#include "internal/platform/logging.h"
#include "internal/platform/scheduled_executor.h"
namespace nearby {
namespace connections {
@@ -356,12 +357,7 @@ class ClientRunnable final {
} // namespace
EncryptionRunner::~EncryptionRunner() {
// Stop all the ongoing Runnables (as gracefully as possible).
client_executor_.Shutdown();
server_executor_.Shutdown();
alarm_executor_.Shutdown();
}
EncryptionRunner::~EncryptionRunner() { Shutdown(); }
void EncryptionRunner::StartServer(ClientProxy* client,
const std::string& endpoint_id,
@@ -381,6 +377,17 @@ void EncryptionRunner::StartClient(ClientProxy* client,
client_executor_.Execute("encryption-client", std::move(runnable));
}
void EncryptionRunner::Shutdown() {
if (is_stopped_.Set(true)) {
return;
}
// Stop all the ongoing Runnables (as gracefully as possible).
client_executor_.Shutdown();
server_executor_.Shutdown();
alarm_executor_.Shutdown();
}
void EncryptionRunner::ResultListener::CallSuccessCallback(
const std::string& endpoint_id,
std::unique_ptr<securegcm::UKey2Handshake> ukey2,