summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/rdma
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys/rdma')
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_wrap.cpp22
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_wrap.h11
2 files changed, 25 insertions, 8 deletions
diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
index efe454c5be..889ee9ff75 100644
--- a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
+++ b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
@@ -105,7 +105,7 @@ namespace Rdma {
}
QueuePair::QueuePair(boost::shared_ptr< ::rdma_cm_id > i) :
- qpid::sys::IOHandle(new qpid::sys::IOHandlePrivate),
+ handle(new qpid::sys::IOHandle),
pd(allocPd(i->verbs)),
cchannel(mkCChannel(i->verbs)),
scq(mkCq(i->verbs, DEFAULT_CQ_ENTRIES, 0, cchannel.get())),
@@ -113,7 +113,7 @@ namespace Rdma {
outstandingSendEvents(0),
outstandingRecvEvents(0)
{
- impl->fd = cchannel->fd;
+ handle->fd = cchannel->fd;
// Set cq context to this QueuePair object so we can find
// ourselves again
@@ -163,6 +163,11 @@ namespace Rdma {
// The buffers vectors automatically deletes all the buffers we've allocated
}
+ QueuePair::operator qpid::sys::IOHandle&() const
+ {
+ return *handle;
+ }
+
// Create buffers to use for writing
void QueuePair::createSendBuffers(int sendBufferCount, int bufferSize, int reserved)
{
@@ -359,11 +364,11 @@ namespace Rdma {
// Wrap the passed in rdma_cm_id with a Connection
// this basically happens only on connection request
Connection::Connection(::rdma_cm_id* i) :
- qpid::sys::IOHandle(new qpid::sys::IOHandlePrivate),
+ handle(new qpid::sys::IOHandle),
id(mkId(i)),
context(0)
{
- impl->fd = id->channel->fd;
+ handle->fd = id->channel->fd;
// Just overwrite the previous context as it will
// have come from the listening connection
@@ -372,12 +377,12 @@ namespace Rdma {
}
Connection::Connection() :
- qpid::sys::IOHandle(new qpid::sys::IOHandlePrivate),
+ handle(new qpid::sys::IOHandle),
channel(mkEChannel()),
id(mkId(channel.get(), this, RDMA_PS_TCP)),
context(0)
{
- impl->fd = channel->fd;
+ handle->fd = channel->fd;
}
Connection::~Connection() {
@@ -385,6 +390,11 @@ namespace Rdma {
id->context = 0;
}
+ Connection::operator qpid::sys::IOHandle&() const
+ {
+ return *handle;
+ }
+
void Connection::ensureQueuePair() {
assert(id.get());
diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.h b/cpp/src/qpid/sys/rdma/rdma_wrap.h
index 8e3429027b..5f84793a5b 100644
--- a/cpp/src/qpid/sys/rdma/rdma_wrap.h
+++ b/cpp/src/qpid/sys/rdma/rdma_wrap.h
@@ -28,6 +28,7 @@
#include "qpid/sys/Mutex.h"
#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/ptr_container/ptr_deque.hpp>
@@ -116,9 +117,10 @@ namespace Rdma {
// Wrapper for a queue pair - this has the functionality for
// putting buffers on the receive queue and for sending buffers
// to the other end of the connection.
- class QueuePair : public qpid::sys::IOHandle, public qpid::RefCounted {
+ class QueuePair : public qpid::RefCounted {
friend class Connection;
+ boost::scoped_ptr< qpid::sys::IOHandle > handle;
boost::shared_ptr< ::ibv_pd > pd;
boost::shared_ptr< ::ibv_mr > smr;
boost::shared_ptr< ::ibv_mr > rmr;
@@ -139,6 +141,8 @@ namespace Rdma {
public:
typedef boost::intrusive_ptr<QueuePair> intrusive_ptr;
+ operator qpid::sys::IOHandle&() const;
+
// Create a buffers to use for writing
void createSendBuffers(int sendBufferCount, int dataSize, int headerSize);
@@ -195,7 +199,8 @@ namespace Rdma {
// registered buffers can't be shared between different connections
// (this can only happen between connections on the same controller in any case,
// so needs careful management if used)
- class Connection : public qpid::sys::IOHandle, public qpid::RefCounted {
+ class Connection : public qpid::RefCounted {
+ boost::scoped_ptr< qpid::sys::IOHandle > handle;
boost::shared_ptr< ::rdma_event_channel > channel;
boost::shared_ptr< ::rdma_cm_id > id;
QueuePair::intrusive_ptr qp;
@@ -216,6 +221,8 @@ namespace Rdma {
public:
typedef boost::intrusive_ptr<Connection> intrusive_ptr;
+ operator qpid::sys::IOHandle&() const;
+
static intrusive_ptr make();
static intrusive_ptr find(::rdma_cm_id* i);