You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2010/06/14 16:50:40 UTC
svn commit: r954498 - in /qpid/trunk/qpid/cpp/src/qpid/sys/rdma: RdmaIO.cpp
RdmaIO.h
Author: astitcher
Date: Mon Jun 14 14:50:40 2010
New Revision: 954498
URL: http://svn.apache.org/viewvc?rev=954498&view=rev
Log:
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
Modified:
qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp?rev=954498&r1=954497&r2=954498&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp Mon Jun 14 14:50:40 2010
@@ -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),
Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h?rev=954498&r1=954497&r2=954498&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h Mon Jun 14 14:50:40 2010
@@ -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;
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org