]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: use HAVE_FEATURE instead
authorKefu Chai <kchai@redhat.com>
Sat, 18 Aug 2018 10:17:51 +0000 (18:17 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 21 Aug 2018 08:22:27 +0000 (16:22 +0800)
so we can check the marker the bit's incarnation also.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/net/SocketConnection.cc
src/crimson/net/SocketConnection.h

index 1c05393581bdc41c0a3992ae3db075ceed345002..1edaf1f90987ca1c755b2a64dbf6b654a6c0e411 100644 (file)
@@ -242,7 +242,7 @@ seastar::future<MessageRef> 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.
index a73329f93d036335c18f3e75137670285a8f91e5..e5d8f2b949494b48c3103cd6ef358a95318b066b 100644 (file)
@@ -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;