]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: put features in connection_state
authorSage Weil <sage@newdream.net>
Thu, 25 Mar 2010 23:01:34 +0000 (16:01 -0700)
committerSage Weil <sage@newdream.net>
Tue, 30 Mar 2010 18:40:38 +0000 (11:40 -0700)
src/msg/Message.h
src/msg/SimpleMessenger.cc

index 212649287d7e319ebbdf09dd6cfeac0cf851792d..601b2ac69cc0a47e588da146d3508618c53e6ddf 100644 (file)
@@ -163,9 +163,10 @@ struct Connection : public RefCountedObject {
   RefCountedObject *priv;
   int peer_type;
   entity_addr_t peer_addr;
+  unsigned features;
 
 public:
-  Connection() : nref(1), lock("Connection::lock"), priv(NULL), peer_type(-1) {}
+  Connection() : nref(1), lock("Connection::lock"), priv(NULL), peer_type(-1), features(0) {}
   ~Connection() {
     //generic_dout(0) << "~Connection " << this << dendl;
     if (priv) {
@@ -202,6 +203,10 @@ public:
   const entity_addr_t& get_peer_addr() { return peer_addr; }
   void set_peer_addr(const entity_addr_t& a) { peer_addr = a; }
 
+  int get_features() const { return features; }
+  bool has_feature(int f) const { return features & f; }
+  void set_features(unsigned f) { features = f; }
+  void set_feature(unsigned f) { features |= f; }
 };
 
 
index 11265737f06e1c6793ede7946a9c6230a64e90ec..808206bae77403df5e55f69cf034bf019c849993 100644 (file)
@@ -848,6 +848,9 @@ int SimpleMessenger::Pipe::accept()
   if (policy.lossy)
     reply.flags = reply.flags | CEPH_MSG_CONNECT_LOSSY;
 
+  connection_state->set_features((int)reply.features & (int)connect.features);
+  dout(10) << "accept features " << connection_state->get_features() << dendl;
+
   // ok!
   register_pipe();
   messenger->lock.Unlock();
@@ -1157,7 +1160,9 @@ int SimpleMessenger::Pipe::connect()
       connect_seq = cseq + 1;
       assert(connect_seq == reply.connect_seq);
       backoff = utime_t();
-      dout(20) << "connect success " << connect_seq << ", lossy = " << policy.lossy << dendl;
+      connection_state->set_features((unsigned)reply.features & (unsigned)connect.features);
+      dout(20) << "connect success " << connect_seq << ", lossy = " << policy.lossy
+              << ", features " << connection_state->get_features() << dendl;
       
       if (!messenger->destination_stopped) {
        Connection * cstate = connection_state->get();