]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: add Connection rx buffer interface
authorSage Weil <sage@newdream.net>
Mon, 15 Nov 2010 04:23:52 +0000 (20:23 -0800)
committerSage Weil <sage@newdream.net>
Mon, 15 Nov 2010 04:23:52 +0000 (20:23 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
src/msg/Message.h

index f4a460160c0fe7e3d14520f9e714e34923c1ce80..a846227144bcfe2d8007c4d663ac48adadebb5b1 100644 (file)
@@ -165,8 +165,12 @@ struct Connection : public RefCountedObject {
   unsigned features;
   RefCountedObject *pipe;
 
+  int rx_buffers_version;
+  map<tid_t,pair<bufferlist,int> > rx_buffers;
+
 public:
-  Connection() : lock("Connection::lock"), priv(NULL), peer_type(-1), features(0), pipe(NULL) {}
+  Connection() : lock("Connection::lock"), priv(NULL), peer_type(-1), features(0), pipe(NULL),
+                rx_buffers_version(0) {}
   ~Connection() {
     //generic_dout(0) << "~Connection " << this << dendl;
     if (priv) {
@@ -223,6 +227,16 @@ public:
   bool has_feature(int f) const { return features & f; }
   void set_features(unsigned f) { features = f; }
   void set_feature(unsigned f) { features |= f; }
+
+  void post_rx_buffer(tid_t tid, bufferlist& bl) {
+    Mutex::Locker l(lock);
+    ++rx_buffers_version;
+    rx_buffers[tid] = pair<bufferlist,int>(bl, rx_buffers_version);
+  }
+  void revoke_rx_buffer(tid_t tid) {
+    Mutex::Locker l(lock);
+    rx_buffers.erase(tid);
+  }
 };