diff options
author | Gordon Sim <gsim@apache.org> | 2014-09-26 15:27:22 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2014-09-26 15:27:22 +0000 |
commit | 800c8d3e93dfd957a86455858075cf46d5f06a46 (patch) | |
tree | 45b65c90029f6ad934fc2d09fafdfbf058ce564e | |
parent | ee6a0e505c4d69d83f4d37a7f6480bab4640c102 (diff) | |
download | qpid-python-800c8d3e93dfd957a86455858075cf46d5f06a46.tar.gz |
QPID-6123: allow for change in engine API introduced in 0.8
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1627809 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/src/amqp.cmake | 3 | ||||
-rw-r--r-- | cpp/src/config.h.cmake | 1 | ||||
-rw-r--r-- | cpp/src/qpid/broker/amqp/Connection.cpp | 30 | ||||
-rw-r--r-- | cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 30 |
4 files changed, 52 insertions, 12 deletions
diff --git a/cpp/src/amqp.cmake b/cpp/src/amqp.cmake index 85617ec59c..3be9f520e0 100644 --- a/cpp/src/amqp.cmake +++ b/cpp/src/amqp.cmake @@ -33,6 +33,9 @@ if (Proton_FOUND) if (NOT Proton_VERSION EQUAL 0.5) set (HAVE_PROTON_TRACER 1) endif (NOT Proton_VERSION EQUAL 0.5) + if (Proton_VERSION GREATER 0.7) + set (USE_PROTON_TRANSPORT_CONDITION 1) + endif (Proton_VERSION GREATER 0.7) else () message(STATUS "Qpid proton not found, amqp 1.0 support not enabled") endif () diff --git a/cpp/src/config.h.cmake b/cpp/src/config.h.cmake index 9e45a9cbb9..f8139262d5 100644 --- a/cpp/src/config.h.cmake +++ b/cpp/src/config.h.cmake @@ -57,5 +57,6 @@ #cmakedefine HAVE_LOG_AUTHPRIV #cmakedefine HAVE_LOG_FTP #cmakedefine HAVE_PROTON_TRACER +#cmakedefine USE_PROTON_TRANSPORT_CONDITION #endif /* QPID_CONFIG_H */ diff --git a/cpp/src/qpid/broker/amqp/Connection.cpp b/cpp/src/qpid/broker/amqp/Connection.cpp index 6754afc0d8..6042af3580 100644 --- a/cpp/src/qpid/broker/amqp/Connection.cpp +++ b/cpp/src/qpid/broker/amqp/Connection.cpp @@ -59,6 +59,29 @@ void set_tracer(pn_transport_t*, void*) { } #endif + +#ifdef USE_PROTON_TRANSPORT_CONDITION +std::string get_error(pn_connection_t* connection, pn_transport_t* transport) +{ + std::stringstream text; + pn_error_t* cerror = pn_connection_error(connection); + if (cerror) text << "connection error " << pn_error_text(cerror) << " [" << cerror << "]"; + pn_condition_t* tcondition = pn_transport_condition(transport); + if (pn_condition_is_set(tcondition)) text << "transport error: " << pn_condition_get_name(tcondition) << ", " << pn_condition_get_description(tcondition); + return text.str(); +} +#else +std::string get_error(pn_connection_t* connection, pn_transport_t* transport) +{ + std::stringstream text; + pn_error_t* cerror = pn_connection_error(connection); + if (cerror) text << "connection error " << pn_error_text(cerror) << " [" << cerror << "]"; + pn_error_t* terror = pn_transport_error(transport); + if (terror) text << "transport error " << pn_error_text(terror) << " [" << terror << "]"; + return text.str(); +} +#endif + } void Connection::trace(const char* message) const @@ -384,12 +407,7 @@ void Connection::processDeliveries() std::string Connection::getError() { - std::stringstream text; - pn_error_t* cerror = pn_connection_error(connection); - if (cerror) text << "connection error " << pn_error_text(cerror) << " [" << cerror << "]"; - pn_error_t* terror = pn_transport_error(transport); - if (terror) text << "transport error " << pn_error_text(terror) << " [" << terror << "]"; - return text.str(); + return get_error(connection, transport); } void Connection::abort() diff --git a/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index 3bee64b9d1..fedab4286f 100644 --- a/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -72,6 +72,29 @@ void set_tracer(pn_transport_t*, void*) { } #endif + +#ifdef USE_PROTON_TRANSPORT_CONDITION +std::string get_error(pn_connection_t* connection, pn_transport_t* transport) +{ + std::stringstream text; + pn_error_t* cerror = pn_connection_error(connection); + if (cerror) text << "connection error " << pn_error_text(cerror) << " [" << cerror << "]"; + pn_condition_t* tcondition = pn_transport_condition(transport); + if (pn_condition_is_set(tcondition)) text << "transport error: " << pn_condition_get_name(tcondition) << ", " << pn_condition_get_description(tcondition); + return text.str(); +} +#else +std::string get_error(pn_connection_t* connection, pn_transport_t* transport) +{ + std::stringstream text; + pn_error_t* cerror = pn_connection_error(connection); + if (cerror) text << "connection error " << pn_error_text(cerror) << " [" << cerror << "]"; + pn_error_t* terror = pn_transport_error(transport); + if (terror) text << "transport error " << pn_error_text(terror) << " [" << terror << "]"; + return text.str(); +} +#endif + } void ConnectionContext::trace(const char* message) const @@ -805,12 +828,7 @@ qpid::framing::ProtocolVersion AMQP_1_0_PLAIN(1,0,qpid::framing::ProtocolVersion std::string ConnectionContext::getError() { - std::stringstream text; - pn_error_t* cerror = pn_connection_error(connection); - if (cerror) text << "connection error " << pn_error_text(cerror); - pn_error_t* terror = pn_transport_error(engine); - if (terror) text << "transport error " << pn_error_text(terror); - return text.str(); + return get_error(connection, engine); } framing::ProtocolVersion ConnectionContext::getVersion() const |