]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: Add get_session function to PaxosServiceMessage
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 25 Mar 2010 17:11:20 +0000 (10:11 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 25 Mar 2010 18:02:21 +0000 (11:02 -0700)
src/messages/PaxosServiceMessage.h

index c5cbba9d64313b6c1658c1ba55f43478618bc6b1..7d6003d2a26caac160819509dfc2192c7e4943c7 100644 (file)
@@ -2,8 +2,7 @@
 #define __PAXOSSERVICEMESSAGE_H
 
 #include "msg/Message.h"
-
-class MonCaps;
+#include "mon/Session.h"
 
 class PaxosServiceMessage : public Message {
  public:
@@ -38,6 +37,20 @@ class PaxosServiceMessage : public Message {
     bufferlist::iterator p = payload.begin();
     paxos_decode(p);
   }
+
+  /** 
+   * These messages are only used by the monitors and clients,
+   * and the client doesn't care, so we're creating a monitor-specific
+   * function here. Note that this function explicitly exists to bypass
+   * the normal ref-counting, so don't expect the returned pointer to be
+   * very long-lived -- it will still only last as long as the Session would
+   * normally.
+   */
+  Session *get_session() {
+    Session *session = (Session *)get_connection()->get_priv();
+    session->put();
+    return session;
+  }
   
   const char *get_type_name() { return "PaxosServiceMessage"; }
 };