From 73aee8e28a8eb784271cdd7ea45ae99a60d1fbae Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 18 Aug 2018 18:17:51 +0800 Subject: [PATCH] crimson/net: use HAVE_FEATURE instead so we can check the marker the bit's incarnation also. Signed-off-by: Kefu Chai --- src/crimson/net/SocketConnection.cc | 9 +++++---- src/crimson/net/SocketConnection.h | 3 --- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index 1c05393581bdc..1edaf1f90987c 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -242,7 +242,7 @@ seastar::future SocketConnection::read_message() bool SocketConnection::update_rx_seq(seq_num_t seq) { if (seq <= in_seq) { - if (has_feature(CEPH_FEATURE_RECONNECT_SEQ) && + if (HAVE_FEATURE(features, RECONNECT_SEQ) && conf.ms_die_on_old_message) { assert(0 == "old msgs despite reconnect_seq feature"); } @@ -270,7 +270,7 @@ seastar::future<> SocketConnection::write_message(MessageRef msg) bl.append(msg->get_middle()); bl.append(msg->get_data()); auto& footer = msg->get_footer(); - if (has_feature(CEPH_FEATURE_MSG_AUTH)) { + if (HAVE_FEATURE(features, MSG_AUTH)) { bl.append((const char*)&footer, sizeof(footer)); } else { ceph_msg_footer_old old_footer; @@ -610,7 +610,8 @@ seastar::future<> SocketConnection::replace_existing(ConnectionRef existing, bool is_reset_from_peer) { msgr_tag_t reply_tag; - if ((h.connect.features & CEPH_FEATURE_RECONNECT_SEQ) && !is_reset_from_peer) { + if (HAVE_FEATURE(h.connect.features, RECONNECT_SEQ) && + !is_reset_from_peer) { reply_tag = CEPH_MSGR_TAG_SEQ; } else { reply_tag = CEPH_MSGR_TAG_READY; @@ -708,7 +709,7 @@ void SocketConnection::reset_session() decltype(sent){}.swap(sent); in_seq = 0; h.connect_seq = 0; - if (has_feature(CEPH_FEATURE_MSG_AUTH)) { + if (HAVE_FEATURE(features, MSG_AUTH)) { // Set out_seq to a random value, so CRC won't be predictable. // Constant to limit starting sequence number to 2^31. Nothing special // about it, just a big number. diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index a73329f93d036..e5d8f2b949494 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -109,9 +109,6 @@ class SocketConnection : public Connection { void set_features(uint64_t new_features) { features = new_features; } - bool has_feature(uint64_t feature) const { - return features & feature; - } /// the seq num of the last transmitted message seq_num_t out_seq = 0; -- 2.39.5