summaryrefslogtreecommitdiff
path: root/qpid/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
commit758ec82123ff11fdfe2e9d7b65b14669d01b2239 (patch)
treed7bb28e40c0b2d010c3457977da4b3aa6df9faba /qpid/cpp/src
parentbb0119256032a5ffe26b57690e28093823b3dba4 (diff)
downloadqpid-python-758ec82123ff11fdfe2e9d7b65b14669d01b2239.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@954498 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp4
-rw-r--r--qpid/cpp/src/qpid/sys/rdma/RdmaIO.h6
2 files changed, 6 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
index 3b49e9759e..25301e9850 100644
--- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
+++ b/qpid/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/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
index 655119b798..4cd0e08592 100644
--- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
+++ b/qpid/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;