]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: move features from Connection to SocketConnection
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 20 Oct 2022 01:57:23 +0000 (09:57 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 21 Oct 2022 09:51:29 +0000 (17:51 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/Connection.h
src/crimson/net/SocketConnection.h

index 084d0a70645b03220429885d5a6bc4e34eb44948..1ff05720d2e70b63d1cc61d8c20a64e61a95377e 100644 (file)
@@ -79,20 +79,6 @@ class Connection : public seastar::enable_shared_from_this<Connection> {
     set_peer_id(name.num());
   }
 
- protected:
-  uint64_t features = 0;
-
- public:
-  void set_features(uint64_t new_features) {
-    features = new_features;
-  }
-  auto get_features() const {
-    return features;
-  }
-  bool has_feature(uint64_t f) const {
-    return features & f;
-  }
-
  public:
   Connection() {}
   virtual ~Connection() {}
@@ -118,6 +104,12 @@ class Connection : public seastar::enable_shared_from_this<Connection> {
   bool peer_is_osd() const { return peer_name.is_osd(); }
   bool peer_is_client() const { return peer_name.is_client(); }
 
+  virtual uint64_t get_features() const = 0;
+
+  bool has_feature(uint64_t f) const {
+    return get_features() & f;
+  }
+
   /// true if the handshake has completed and no errors have been encountered
   virtual bool is_connected() const = 0;
 
index a33c525ed5f1bf8a616761b724e67a4952da57c4..90c330b57b4ff160b68f85c926b4127b641201c3 100644 (file)
@@ -33,6 +33,8 @@ class SocketConnection : public Connection {
   SocketMessenger& messenger;
   std::unique_ptr<Protocol> protocol;
 
+  uint64_t features = 0;
+
   ceph::net::Policy<crimson::common::Throttle> policy;
 
   /// the seq num of the last transmitted message
@@ -58,6 +60,10 @@ class SocketConnection : public Connection {
                    ChainedDispatchers& dispatchers);
   ~SocketConnection() override;
 
+  uint64_t get_features() const override {
+    return features;
+  }
+
   bool is_connected() const override;
 
 #ifdef UNIT_TESTS_BUILT
@@ -78,6 +84,10 @@ class SocketConnection : public Connection {
 
   void print(std::ostream& out) const override;
 
+  void set_features(uint64_t f) {
+    features = f;
+  }
+
   /// start a handshake from the client's perspective,
   /// only call when SocketConnection first construct
   void start_connect(const entity_addr_t& peer_addr,