From 34128a35deab88cda6352c11a7e53c276db3a2b0 Mon Sep 17 00:00:00 2001 From: Juliet Levesque Date: Tue, 27 Jun 2023 14:45:01 -0700 Subject: [PATCH] [Nearby Connections] Enable Cancellation Flags Re-enables Cancellation Flags once fixes for crashes caused by destroying the cancellation flags that are being consumed by other classes have landed. PiperOrigin-RevId: 543857192 --- internal/platform/feature_flags.h | 2 +- internal/platform/feature_flags_test.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/platform/feature_flags.h b/internal/platform/feature_flags.h index 9aae0f39..8ff66d12 100644 --- a/internal/platform/feature_flags.h +++ b/internal/platform/feature_flags.h @@ -26,7 +26,7 @@ class FeatureFlags { public: // Holds for all the feature flags. struct Flags { - bool enable_cancellation_flag = false; + bool enable_cancellation_flag = true; bool enable_async_bandwidth_upgrade = true; // If a scheduled runnable is already running, Cancel() will synchronously // wait for the task to complete. diff --git a/internal/platform/feature_flags_test.cc b/internal/platform/feature_flags_test.cc index 3d4925ef..e6e4eedd 100644 --- a/internal/platform/feature_flags_test.cc +++ b/internal/platform/feature_flags_test.cc @@ -21,23 +21,23 @@ namespace nearby { namespace { constexpr FeatureFlags::Flags kTestFeatureFlags{ - .enable_cancellation_flag = true, + .enable_cancellation_flag = false, .keep_alive_interval_millis = 5000, .keep_alive_timeout_millis = 30000}; TEST(FeatureFlagsTest, ToSetFeatureWorks) { const FeatureFlags& features = FeatureFlags::GetInstance(); - EXPECT_FALSE(features.GetFlags().enable_cancellation_flag); + EXPECT_TRUE(features.GetFlags().enable_cancellation_flag); EXPECT_EQ(5000, features.GetFlags().keep_alive_interval_millis); EXPECT_EQ(30000, features.GetFlags().keep_alive_timeout_millis); MediumEnvironment& medium_environment = MediumEnvironment::Instance(); medium_environment.SetFeatureFlags(kTestFeatureFlags); - EXPECT_TRUE(features.GetFlags().enable_cancellation_flag); + EXPECT_FALSE(features.GetFlags().enable_cancellation_flag); const FeatureFlags& another_features_ref = FeatureFlags::GetInstance(); - EXPECT_TRUE(another_features_ref.GetFlags().enable_cancellation_flag); + EXPECT_FALSE(another_features_ref.GetFlags().enable_cancellation_flag); } } // namespace