From 829b44f73e0825f838099af4b683b1f744c0e2aa Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 20 Dec 2013 15:06:35 +0000 Subject: QPID-5431: Qpid c++ client hangs / crashes during reception failover in HA environment (mutual recursion) Bug in AMQP 1.0 retry code caused an infinite recursion when failing over. The recursion was in messaging::amqp::ConnectionContext, where the following recursive cycle could occur: check()->autoconnect()->tryConnect(Url)->tryConnect(Address)->wait()->check()->... Re-organized the code to avoid the recursion, specifically avoid calling check() in tryConnect(Address). A disconnect detected in tryConnect results in continuing the retry rather than calling autoconnect again. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1552698 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/examples/messaging/drain.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/examples/messaging') diff --git a/qpid/cpp/examples/messaging/drain.cpp b/qpid/cpp/examples/messaging/drain.cpp index aa2d7b4964..bfd9bdccbe 100644 --- a/qpid/cpp/examples/messaging/drain.cpp +++ b/qpid/cpp/examples/messaging/drain.cpp @@ -82,8 +82,9 @@ int main(int argc, char** argv) { Options options; if (options.parse(argc, argv) && options.checkAddress()) { - Connection connection(options.url, options.connectionOptions); + Connection connection; try { + connection = Connection(options.url, options.connectionOptions); connection.open(); Session session = connection.createSession(); Receiver receiver = session.createReceiver(options.address); @@ -103,7 +104,7 @@ int main(int argc, char** argv) connection.close(); return 0; } catch(const std::exception& error) { - std::cout << error.what() << std::endl; + std::cout << "Error: " << error.what() << std::endl; connection.close(); } } -- cgit v1.2.1