Internal change

PiperOrigin-RevId: 383512322
This commit is contained in:
Janusz Sobczak
2021-07-07 16:02:54 -07:00
committed by Copybara-Service
parent a1c787e62c
commit 15996d64dd
3 changed files with 16 additions and 3 deletions
@@ -265,6 +265,8 @@ class BasePcpHandlerTest
.allowed = allowed,
.auto_upgrade_bandwidth = true,
.enforce_topology_constraints = true,
.keep_alive_interval_millis = 5000,
.keep_alive_timeout_millis = 3000,
};
EXPECT_CALL(*pcp_handler, StartDiscoveryImpl(client, service_id, _))
.WillOnce(Return(MockPcpHandler::StartOperationResult{
+4 -1
View File
@@ -113,7 +113,10 @@ class EndpointManagerTest : public ::testing::Test {
}
ClientProxy client_;
ConnectionOptions options_;
ConnectionOptions options_{
.keep_alive_interval_millis = 5000,
.keep_alive_timeout_millis = 30000,
};
std::vector<std::unique_ptr<EndpointManager::FrameProcessor>> processors_;
EndpointChannelManager ecm_;
EndpointManager em_{&ecm_};
+10 -2
View File
@@ -95,8 +95,10 @@ void MediumEnvironment::OnBluetoothAdapterChangedState(
api::BluetoothAdapter& adapter, api::BluetoothDevice& adapter_device,
std::string name, bool enabled, api::BluetoothAdapter::ScanMode mode) {
if (!enabled_) return;
CountDownLatch latch(1);
RunOnMediumEnvironmentThread([this, &adapter, &adapter_device,
name = std::move(name), enabled, mode]() {
name = std::move(name), enabled, mode,
&latch]() {
NEARBY_LOG(INFO,
"[adapter=%p, device=%p] update: name=%s, enabled=%d, mode=%d",
&adapter, &adapter_device, name.c_str(), enabled, mode);
@@ -112,8 +114,14 @@ void MediumEnvironment::OnBluetoothAdapterChangedState(
// pointer. Pointer must remain valid for the duration of a Core session
// (since it is owned by the correspoinding Medium, and mediums lifetime
// matches Core lifetime).
bluetooth_adapters_.emplace(&adapter, &adapter_device);
if (enabled) {
bluetooth_adapters_.emplace(&adapter, &adapter_device);
} else {
bluetooth_adapters_.erase(&adapter);
}
latch.CountDown();
});
latch.Await();
}
void MediumEnvironment::OnBluetoothDeviceStateChanged(