Author: gsim Date: Fri Sep 26 15:27:22 2014 New Revision: 1627809 URL: http://svn.apache.org/r1627809 Log: QPID-6123: allow for change in engine API introduced in 0.8
Modified: qpid/trunk/qpid/cpp/src/amqp.cmake qpid/trunk/qpid/cpp/src/config.h.cmake qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp Modified: qpid/trunk/qpid/cpp/src/amqp.cmake URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/amqp.cmake?rev=1627809&r1=1627808&r2=1627809&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/amqp.cmake (original) +++ qpid/trunk/qpid/cpp/src/amqp.cmake Fri Sep 26 15:27:22 2014 @@ -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 () Modified: qpid/trunk/qpid/cpp/src/config.h.cmake URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/config.h.cmake?rev=1627809&r1=1627808&r2=1627809&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/config.h.cmake (original) +++ qpid/trunk/qpid/cpp/src/config.h.cmake Fri Sep 26 15:27:22 2014 @@ -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 */ Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp?rev=1627809&r1=1627808&r2=1627809&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Connection.cpp Fri Sep 26 15:27:22 2014 @@ -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() Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp?rev=1627809&r1=1627808&r2=1627809&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp Fri Sep 26 15:27:22 2014 @@ -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_ 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 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org