diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2010-06-14 14:50:16 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2010-06-14 14:50:16 +0000 |
| commit | 469827da5b92d5b6351f0672ee087e4febc35b7e (patch) | |
| tree | 7b06b46388dca73a9bc6e1903a8f038379dfd57f /qpid/cpp/src | |
| parent | 9d560565c5e468387ae54be3d599918fce2a3f16 (diff) | |
| download | qpid-python-469827da5b92d5b6351f0672ee087e4febc35b7e.tar.gz | |
In Rdma::AsynchIO::stop():
- make sure we stop the underlying handle immediately whether or not
we do the stopped callback now or have to defer it.
In qpid::client::RdmaConnector:
- make sure that the shutdown handler is called under all circumstances.
- make sure that the destructor doesn't delete the aio if it is
already deleted
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@954492 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/client/RdmaConnector.cpp | 19 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp | 6 |
2 files changed, 19 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/client/RdmaConnector.cpp b/qpid/cpp/src/qpid/client/RdmaConnector.cpp index 9be9e7127c..624f457d8d 100644 --- a/qpid/cpp/src/qpid/client/RdmaConnector.cpp +++ b/qpid/cpp/src/qpid/client/RdmaConnector.cpp @@ -162,7 +162,12 @@ namespace { RdmaConnector::~RdmaConnector() { QPID_LOG(debug, "~RdmaConnector " << identifier); close(); - if (aio) aio->stop(deleteAsynchIO); + if (aio) { + aio->stop(deleteAsynchIO); + } + if (shutdownHandler) { + shutdownHandler->shutdown(); + } } void RdmaConnector::connect(const std::string& host, int port){ @@ -244,15 +249,21 @@ void RdmaConnector::dataError(Rdma::AsynchIO&) { drained(); } -void RdmaConnector::stopped(Rdma::AsynchIO* aio) { - delete aio; +void RdmaConnector::stopped(Rdma::AsynchIO* a) { + QPID_LOG(debug, "RdmaConnector::stopped " << identifier); + assert(!polling); + aio = 0; + delete a; if (shutdownHandler) { - shutdownHandler->shutdown(); + ShutdownHandler* s = shutdownHandler; + shutdownHandler = 0; + s->shutdown(); } } void RdmaConnector::drained() { QPID_LOG(debug, "RdmaConnector::drained " << identifier); + assert(!polling); if (aio) { aio->stop(boost::bind(&RdmaConnector::stopped, this, aio)); aio = 0; diff --git a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp index 32bd9cd96b..e91127ee7b 100644 --- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -117,11 +117,14 @@ namespace Rdma { newState = SHUTDOWN; } while (!state.boolCompareAndSwap(oldState, newState)); + + // Ensure we can't get any more callbacks (except for the stopped callback) + dataHandle.stopWatch(); + if (doReturn) { notifyCallback = nc; return; } - dataHandle.stopWatch(); // Callback, but don't store it - SHUTDOWN state means callback has been called // we *are* allowed to delete the AsynchIO in this callback, so we have to return immediately // after the callback @@ -473,7 +476,6 @@ namespace Rdma { } void AsynchIO::doStoppedCallback() { - dataHandle.stopWatch(); NotifyCallback nc; nc.swap(notifyCallback); // Transition unconditionally to SHUTDOWN |
