diff options
Diffstat (limited to 'qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp')
-rw-r--r-- | qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp index fe7062d3ea..23660a0b9f 100644 --- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -518,6 +518,7 @@ namespace Rdma { ErrorCallback errc, DisconnectedCallback dc ) : + state(IDLE), ci(Connection::make()), handle(*ci, boost::bind(&ConnectionManager::event, this, _1), 0, 0), errorCallback(errc), @@ -537,11 +538,23 @@ namespace Rdma { handle.startWatch(poller); } - void ConnectionManager::stop() { + void ConnectionManager::doStoppedCallback() { + // Ensure we can't get any more callbacks (except for the stopped callback) handle.stopWatch(); + + NotifyCallback nc; + nc.swap(notifyCallback); + nc(*this); + } + + void ConnectionManager::stop(NotifyCallback nc) { + state = STOPPED; + notifyCallback = nc; + handle.call(boost::bind(&ConnectionManager::doStoppedCallback, this)); } void ConnectionManager::event(DispatchHandle&) { + if (state.get() == STOPPED) return; connectionEvent(ci); } |