From 2a5bdb8c9b586328c99a54685e125f4f6cb78076 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 1 Sep 2021 19:44:00 +0000 Subject: [PATCH] msg: make Policy::features_supported static and constant. This is an offspring of a bug investigation that required proving `Policy::features_supported` never changes. Signed-off-by: Radoslaw Zarzynski --- src/msg/Policy.h | 9 ++++++--- src/test/msgr/test_msgr.cc | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/msg/Policy.h b/src/msg/Policy.h index 10a426f2f4689..0cfa03aee5701 100644 --- a/src/msg/Policy.h +++ b/src/msg/Policy.h @@ -42,7 +42,12 @@ struct Policy { ThrottleType* throttler_messages; /// Specify features supported locally by the endpoint. - uint64_t features_supported; +#ifdef MSG_POLICY_UNIT_TESTING + uint64_t features_supported{CEPH_FEATURES_SUPPORTED_DEFAULT}; +#else + static constexpr uint64_t features_supported{CEPH_FEATURES_SUPPORTED_DEFAULT}; +#endif + /// Specify features any remotes must have to talk to this endpoint. uint64_t features_required; @@ -50,7 +55,6 @@ struct Policy { : lossy(false), server(false), standby(false), resetcheck(true), throttler_bytes(NULL), throttler_messages(NULL), - features_supported(CEPH_FEATURES_SUPPORTED_DEFAULT), features_required(0) {} private: Policy(bool l, bool s, bool st, bool r, bool rlc, uint64_t req) @@ -58,7 +62,6 @@ private: register_lossy_clients(rlc), throttler_bytes(NULL), throttler_messages(NULL), - features_supported(CEPH_FEATURES_SUPPORTED_DEFAULT), features_required(req) {} public: diff --git a/src/test/msgr/test_msgr.cc b/src/test/msgr/test_msgr.cc index 739cb4ea63743..17f679b0904e3 100644 --- a/src/test/msgr/test_msgr.cc +++ b/src/test/msgr/test_msgr.cc @@ -28,6 +28,8 @@ #include #include +#define MSG_POLICY_UNIT_TESTING + #include "common/ceph_argparse.h" #include "common/ceph_mutex.h" #include "global/global_init.h" -- 2.39.5