From: Sage Weil Date: Mon, 15 Nov 2010 04:23:52 +0000 (-0800) Subject: msgr: add Connection rx buffer interface X-Git-Tag: v0.24~185^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2854dae80f5c5c113e4162bd7365980fa743f05a;p=ceph.git msgr: add Connection rx buffer interface Signed-off-by: Sage Weil --- diff --git a/src/msg/Message.h b/src/msg/Message.h index f4a460160c0f..a846227144bc 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -165,8 +165,12 @@ struct Connection : public RefCountedObject { unsigned features; RefCountedObject *pipe; + int rx_buffers_version; + map > 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(bl, rx_buffers_version); + } + void revoke_rx_buffer(tid_t tid) { + Mutex::Locker l(lock); + rx_buffers.erase(tid); + } };