summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/rdma/RdmaIO.cpp4
-rw-r--r--cpp/src/qpid/sys/rdma/RdmaIO.h4
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_wrap.cpp6
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_wrap.h2
4 files changed, 7 insertions, 9 deletions
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp
index 845e84eec3..aa0dfbd5a4 100644
--- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp
+++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp
@@ -64,14 +64,12 @@ namespace Rdma {
for (int i = 0; i<recvBufferCount; ++i) {
// Allocate recv buffer
Buffer* b = qp->createBuffer(bufferSize);
- buffers.push_front(b);
qp->postRecv(b);
}
for (int i = 0; i<xmitBufferCount; ++i) {
// Allocate xmit buffer
Buffer* b = qp->createBuffer(bufferSize);
- buffers.push_front(b);
bufferQueue.push_front(b);
}
}
@@ -86,8 +84,6 @@ namespace Rdma {
QPID_LOG(error, "RDMA: qp=" << qp << ": Deleting queue whilst not shutdown");
dataHandle.stopWatch();
}
-
- // The buffers ptr_deque automatically deletes all the buffers we've allocated
// TODO: It might turn out to be more efficient in high connection loads to reuse the
// buffers rather than having to reregister them all the time (this would be straightforward if all
// connections haver the same buffer size and harder otherwise)
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.h b/cpp/src/qpid/sys/rdma/RdmaIO.h
index 4cd0e08592..aabb330c42 100644
--- a/cpp/src/qpid/sys/rdma/RdmaIO.h
+++ b/cpp/src/qpid/sys/rdma/RdmaIO.h
@@ -32,7 +32,6 @@
#include <netinet/in.h>
#include <boost/function.hpp>
-#include <boost/ptr_container/ptr_deque.hpp>
#include <deque>
namespace Rdma {
@@ -59,9 +58,6 @@ namespace Rdma {
//qpid::sys::Mutex stateLock;
std::deque<Buffer*> bufferQueue;
qpid::sys::Mutex bufferQueueLock;
- boost::ptr_deque<Buffer> buffers;
- // The QueuePair must be after the buffers so that the connection is destroyed before the buffers
- // are deallocated so that the hardware doesn't write into memory that's been given back.
QueuePair::intrusive_ptr qp;
qpid::sys::DispatchHandleRef dataHandle;
diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
index 2581aaedcb..b046b012db 100644
--- a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
+++ b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
@@ -154,11 +154,15 @@ namespace Rdma {
// Reset back pointer in case someone else has the qp
qp->qp_context = 0;
+
+ // The buffers ptr_deque automatically deletes all the buffers we've allocated
}
// Create a buffer to use for writing
Buffer* QueuePair::createBuffer(int s) {
- return new Buffer(pd.get(), s);
+ Buffer* b = new Buffer(pd.get(), s);
+ buffers.push_front(b);
+ return b;
}
// Make channel non-blocking by making
diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.h b/cpp/src/qpid/sys/rdma/rdma_wrap.h
index 54066d1d41..488cf8c646 100644
--- a/cpp/src/qpid/sys/rdma/rdma_wrap.h
+++ b/cpp/src/qpid/sys/rdma/rdma_wrap.h
@@ -28,6 +28,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
+#include <boost/ptr_container/ptr_deque.hpp>
namespace qpid {
namespace sys {
@@ -121,6 +122,7 @@ namespace Rdma {
boost::shared_ptr< ::ibv_qp > qp;
int outstandingSendEvents;
int outstandingRecvEvents;
+ boost::ptr_deque<Buffer> buffers;
QueuePair(boost::shared_ptr< ::rdma_cm_id > id);
~QueuePair();