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 | 496a602e2fc76224f835b379a3b301f35f2fac8e (patch) | |
| tree | a1d8794cfa664ac1d6417ee768aeab7a9be49a59 /qpid/cpp | |
| parent | 4ab0faf373ce623ab812a9ad128efb6087bd2099 (diff) | |
| download | qpid-python-496a602e2fc76224f835b379a3b301f35f2fac8e.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@1627809 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
| -rw-r--r-- | qpid/cpp/src/amqp.cmake | 3 | ||||
| -rw-r--r-- | qpid/cpp/src/config.h.cmake | 1 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/amqp/Connection.cpp | 30 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 30 |
4 files changed, 52 insertions, 12 deletions
diff --git a/qpid/cpp/src/amqp.cmake b/qpid/cpp/src/amqp.cmake index 85617ec59c..3be9f520e0 100644 --- a/qpid/cpp/src/amqp.cmake +++ b/qpid/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/qpid/cpp/src/config.h.cmake b/qpid/cpp/src/config.h.cmake index 9e45a9cbb9..f8139262d5 100644 --- a/qpid/cpp/src/config.h.cmake +++ b/qpid/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/qpid/cpp/src/qpid/broker/amqp/Connection.cpp b/qpid/cpp/src/qpid/broker/amqp/Connection.cpp index 6754afc0d8..6042af3580 100644 --- a/qpid/cpp/src/qpid/broker/amqp/Connection.cpp +++ b/qpid/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/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index 3bee64b9d1..fedab4286f 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/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 |
