summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:40 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-06-14 14:50:40 +0000
commitaf2cd2a34e5ec0b699ae7ba85b37ade8241aa730 (patch)
treec8ad11d451c98b530246ed4e36d1b2fd26009b9f /cpp/src
parent29586367f102a16970c68459b8ea5c779f7cb2d7 (diff)
downloadqpid-python-af2cd2a34e5ec0b699ae7ba85b37ade8241aa730.tar.gz
Move QueuePair member in Rdma::AsynchIO to ensure that it get destroyed before
the buffers it uses, so that there is no hardware activity using them after they are deleted git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@954498 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/rdma/RdmaIO.cpp4
-rw-r--r--cpp/src/qpid/sys/rdma/RdmaIO.h6
2 files changed, 6 insertions, 4 deletions
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp
index 3b49e9759e..25301e9850 100644
--- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp
+++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp
@@ -41,8 +41,6 @@ namespace Rdma {
FullCallback fc,
ErrorCallback ec
) :
- qp(q),
- dataHandle(*qp, boost::bind(&AsynchIO::dataEvent, this), 0, 0),
bufferSize(size),
recvCredit(0),
xmitCredit(xCredit),
@@ -51,6 +49,8 @@ namespace Rdma {
outstandingWrites(0),
draining(false),
state(IDLE),
+ qp(q),
+ dataHandle(*qp, boost::bind(&AsynchIO::dataEvent, this), 0, 0),
readCallback(rc),
idleCallback(ic),
fullCallback(fc),
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.h b/cpp/src/qpid/sys/rdma/RdmaIO.h
index 655119b798..4cd0e08592 100644
--- a/cpp/src/qpid/sys/rdma/RdmaIO.h
+++ b/cpp/src/qpid/sys/rdma/RdmaIO.h
@@ -47,8 +47,6 @@ namespace Rdma {
typedef boost::function2<void, AsynchIO&, Buffer*> FullCallback;
typedef boost::function1<void, AsynchIO&> NotifyCallback;
- QueuePair::intrusive_ptr qp;
- qpid::sys::DispatchHandleRef dataHandle;
int bufferSize;
int recvCredit;
int xmitCredit;
@@ -62,6 +60,10 @@ namespace Rdma {
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;
ReadCallback readCallback;
IdleCallback idleCallback;