summaryrefslogtreecommitdiff
path: root/qpid/cpp/examples
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-12-20 15:06:35 +0000
committerAlan Conway <aconway@apache.org>2013-12-20 15:06:35 +0000
commit829b44f73e0825f838099af4b683b1f744c0e2aa (patch)
tree50123bc073572ab16794cb5213fba18ab2b3c86c /qpid/cpp/examples
parentf87fbe5b1f0441c1066be6db0836097eda48b02c (diff)
downloadqpid-python-829b44f73e0825f838099af4b683b1f744c0e2aa.tar.gz
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
Diffstat (limited to 'qpid/cpp/examples')
-rw-r--r--qpid/cpp/examples/messaging/drain.cpp5
1 files changed, 3 insertions, 2 deletions
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();
}
}