]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: make Policy::features_supported static and constant. 43013/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 1 Sep 2021 19:44:00 +0000 (19:44 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 2 Sep 2021 10:41:32 +0000 (10:41 +0000)
This is an offspring of a bug investigation that required proving
`Policy::features_supported` never changes.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/msg/Policy.h
src/test/msgr/test_msgr.cc

index 10a426f2f468933b3bc902b69056f555e855c1ce..0cfa03aee5701c197fde1985f175d5d26adfaf70 100644 (file)
@@ -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:
index 739cb4ea63743299a6bdedd7990f2b639c455e5d..17f679b0904e3f5196aafc0c85dde4348586375c 100644 (file)
@@ -28,6 +28,8 @@
 #include <boost/random/uniform_int.hpp>
 #include <gtest/gtest.h>
 
+#define MSG_POLICY_UNIT_TESTING
+
 #include "common/ceph_argparse.h"
 #include "common/ceph_mutex.h"
 #include "global/global_init.h"