From 057d6d27d53a55ba19eaff8487727ab5d9df2768 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Mon, 31 Aug 2009 20:18:48 +0000 Subject: Added protocol module for codepoint definitions and header handling. Fixed a deadlock case in ResilientConnection. Added more code to the ConsoleEngine implementation. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@809728 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qmf/ResilientConnection.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/qmf/ResilientConnection.cpp') diff --git a/qpid/cpp/src/qmf/ResilientConnection.cpp b/qpid/cpp/src/qmf/ResilientConnection.cpp index 88b9169c75..a6f9eddcde 100644 --- a/qpid/cpp/src/qmf/ResilientConnection.cpp +++ b/qpid/cpp/src/qmf/ResilientConnection.cpp @@ -318,6 +318,7 @@ void ResilientConnectionImpl::run() while (true) { try { + QPID_LOG(trace, "Trying to open connection..."); connection.open(settings.impl->getClientSettings()); { Mutex::ScopedLock _lock(lock); @@ -326,6 +327,7 @@ void ResilientConnectionImpl::run() while (connected) cond.wait(lock); + delay = delayMin; while (!sessions.empty()) { set::iterator iter = sessions.begin(); @@ -334,6 +336,11 @@ void ResilientConnectionImpl::run() EnqueueEvent(ResilientConnectionEvent::SESSION_CLOSED, sess->userContext); Mutex::ScopedUnlock _u(lock); sess->stop(); + + // Nullify the intrusive pointer within the scoped unlock, otherwise, + // the reference is held until overwritted above (under lock) which causes + // the session destructor to be called with the lock held. + sess = 0; } EnqueueEvent(ResilientConnectionEvent::DISCONNECTED); @@ -341,7 +348,6 @@ void ResilientConnectionImpl::run() if (shutdown) return; } - delay = delayMin; connection.close(); } catch (exception &e) { QPID_LOG(debug, "connection.open exception: " << e.what()); -- cgit v1.2.1