You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2010/10/08 00:21:19 UTC

svn commit: r1005654 - in /qpid/trunk/qpid/cpp: bindings/qpid/python/python.i src/qmf/AgentSession.cpp

Author: tross
Date: Thu Oct  7 22:21:19 2010
New Revision: 1005654

URL: http://svn.apache.org/viewvc?rev=1005654&view=rev
Log:
Fix session-shutdown-after-failure so it does not cause a segfault.
Fixed the method-call wrapper for Python in the qpid messaging wrapper to properly
handle and translate C++ exceptions.

Modified:
    qpid/trunk/qpid/cpp/bindings/qpid/python/python.i
    qpid/trunk/qpid/cpp/src/qmf/AgentSession.cpp

Modified: qpid/trunk/qpid/cpp/bindings/qpid/python/python.i
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/python/python.i?rev=1005654&r1=1005653&r2=1005654&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/python/python.i (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/python/python.i Thu Oct  7 22:21:19 2010
@@ -23,13 +23,16 @@
 
 /* Define the general-purpose exception handling */
 %exception {
+    std::string error;
+    Py_BEGIN_ALLOW_THREADS;
     try {
-        Py_BEGIN_ALLOW_THREADS
         $action
-        Py_END_ALLOW_THREADS
+    } catch (qpid::types::Exception& ex) {
+        error = ex.what();
     }
-    catch (qpid::messaging::MessagingException& mex) {
-        PyErr_SetString(PyExc_RuntimeError, mex.what());
+    Py_END_ALLOW_THREADS;
+    if (!error.empty()) {
+        PyErr_SetString(PyExc_RuntimeError, error.c_str());
         return NULL;
     }
 }

Modified: qpid/trunk/qpid/cpp/src/qmf/AgentSession.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/AgentSession.cpp?rev=1005654&r1=1005653&r2=1005654&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/AgentSession.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/AgentSession.cpp Thu Oct  7 22:21:19 2010
@@ -223,7 +223,6 @@ void AgentSessionImpl::open()
 {
     if (opened)
         throw QmfException("The session is already open");
-    opened = true;
 
     const string addrArgs(";{create:never,node:{type:topic}}");
 
@@ -245,6 +244,7 @@ void AgentSessionImpl::open()
 
     // Start the receiver thread
     threadCanceled = false;
+    opened = true;
     thread = new qpid::sys::Thread(*this);
 
     // Send an initial agent heartbeat message
@@ -255,7 +255,7 @@ void AgentSessionImpl::open()
 void AgentSessionImpl::close()
 {
     if (!opened)
-        throw QmfException("The session is already closed");
+        return;
 
     // Stop and join the receiver thread
     threadCanceled = true;



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org