From: Yingxin Cheng Date: Thu, 20 Oct 2022 01:57:23 +0000 (+0800) Subject: crimson/net: move features from Connection to SocketConnection X-Git-Tag: v18.1.0~967^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=77b4ba6fea0fb5eeb7fc06fd418714a18479303a;p=ceph.git crimson/net: move features from Connection to SocketConnection Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/Connection.h b/src/crimson/net/Connection.h index 084d0a70645b..1ff05720d2e7 100644 --- a/src/crimson/net/Connection.h +++ b/src/crimson/net/Connection.h @@ -79,20 +79,6 @@ class Connection : public seastar::enable_shared_from_this { 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 { 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; diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index a33c525ed5f1..90c330b57b4f 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -33,6 +33,8 @@ class SocketConnection : public Connection { SocketMessenger& messenger; std::unique_ptr protocol; + uint64_t features = 0; + ceph::net::Policy 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,