You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jr...@apache.org on 2018/03/14 20:50:47 UTC

[13/14] qpid-cpp git commit: QPID-7054: Fix crash when closing a sender after the connection has been closed. Thanks to Håkan Johansson for the patch.

QPID-7054: Fix crash when closing a sender after the connection has been closed.  Thanks to Håkan Johansson for the patch.


Project: http://git-wip-us.apache.org/repos/asf/qpid-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-cpp/commit/b2bfd9b2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-cpp/tree/b2bfd9b2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-cpp/diff/b2bfd9b2

Branch: refs/heads/master
Commit: b2bfd9b2a46d4d4529d9588df762c4a524a3f6a7
Parents: 3b6f718
Author: Justin Ross <jr...@apache.org>
Authored: Mon Mar 12 18:08:20 2018 -0700
Committer: Justin Ross <jr...@apache.org>
Committed: Wed Mar 14 10:46:27 2018 -0700

----------------------------------------------------------------------
 src/qpid/messaging/amqp/ConnectionContext.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/b2bfd9b2/src/qpid/messaging/amqp/ConnectionContext.cpp
----------------------------------------------------------------------
diff --git a/src/qpid/messaging/amqp/ConnectionContext.cpp b/src/qpid/messaging/amqp/ConnectionContext.cpp
index 097e8f8..5d3a1e3 100644
--- a/src/qpid/messaging/amqp/ConnectionContext.cpp
+++ b/src/qpid/messaging/amqp/ConnectionContext.cpp
@@ -377,14 +377,20 @@ void ConnectionContext::nack(boost::shared_ptr<SessionContext> ssn, qpid::messag
 void ConnectionContext::detach(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<SenderContext> lnk)
 {
     sys::Monitor::ScopedLock l(lock);
+
     if (pn_link_state(lnk->sender) & PN_LOCAL_ACTIVE) {
         lnk->close();
     }
-    wakeupDriver();
-    while (pn_link_state(lnk->sender) & PN_REMOTE_ACTIVE) {
-        wait(ssn);
+
+    if (state == CONNECTED) {
+        wakeupDriver();
+        while (pn_link_state(lnk->sender) & PN_REMOTE_ACTIVE) {
+            wait(ssn);
+        }
     }
+
     ssn->removeSender(lnk->getName());
+    lnk->reset(0);
 }
 
 void ConnectionContext::drain_and_release_messages(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org