From fc176e48b9a9878df273561147ff565265535d05 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 4 Sep 2019 13:38:38 +0200 Subject: [PATCH] crimson/osd: Message uses Connection instead of SocketConnection. Signed-off-by: Radoslaw Zarzynski --- src/crimson/net/Connection.h | 22 ++++++++++++++++++++++ src/crimson/net/SocketConnection.h | 19 ------------------- src/msg/Message.h | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/crimson/net/Connection.h b/src/crimson/net/Connection.h index 3e0eaa6c5c7..ed96da732bc 100644 --- a/src/crimson/net/Connection.h +++ b/src/crimson/net/Connection.h @@ -29,6 +29,11 @@ class Connection : public seastar::enable_shared_from_this { protected: entity_addr_t peer_addr; + + // which of the peer_addrs we're connecting to (as client) + // or should reconnect to (as peer) + entity_addr_t target_addr; + using clock_t = seastar::lowres_system_clock; clock_t::time_point last_keepalive; clock_t::time_point last_keepalive_ack; @@ -40,6 +45,20 @@ class Connection : public seastar::enable_shared_from_this { public: uint64_t peer_global_id = 0; + protected: + uint64_t features; + + 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() {} @@ -49,6 +68,9 @@ class Connection : public seastar::enable_shared_from_this { const entity_addrvec_t get_peer_addrs() const { return entity_addrvec_t(peer_addr); } + const auto& get_peer_socket_addr() const { + return target_addr; + } const entity_name_t& get_peer_name() const { return peer_name; } entity_type_t get_peer_type() const { return peer_name.type(); } int64_t get_peer_id() const { return peer_name.num(); } diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index 68590681543..2c66a4e5c7e 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -48,10 +48,6 @@ class SocketConnection : public Connection { } ceph::net::Policy policy; - uint64_t features; - void set_features(uint64_t new_features) { - features = new_features; - } /// the seq num of the last transmitted message seq_num_t out_seq = 0; @@ -68,10 +64,6 @@ class SocketConnection : public Connection { // messages sent, but not yet acked by peer std::deque sent; - // which of the peer_addrs we're connecting to (as client) - // or should reconnect to (as peer) - entity_addr_t target_addr; - public: SocketConnection(SocketMessenger& messenger, Dispatcher& dispatcher, @@ -109,17 +101,6 @@ class SocketConnection : public Connection { return policy.lossy; } - const auto& get_peer_socket_addr() const { - return target_addr; - } - - auto get_features() const { - return features; - } - bool has_feature(uint64_t f) const { - return features & f; - } - friend class Protocol; friend class ProtocolV1; friend class ProtocolV2; diff --git a/src/msg/Message.h b/src/msg/Message.h index 60f0363d579..8dbdbe1cf12 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -227,7 +227,7 @@ class Message : public RefCountedObject { public: #ifdef WITH_SEASTAR - using ConnectionRef = ceph::net::SocketConnectionRef; + using ConnectionRef = ceph::net::ConnectionRef; #else using ConnectionRef = ::ConnectionRef; #endif // WITH_SEASTAR -- 2.39.5