summaryrefslogtreecommitdiff
path: root/cpp/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/tests')
-rw-r--r--cpp/src/tests/qpid_recv.cpp3
-rw-r--r--cpp/src/tests/qpid_send.cpp3
-rw-r--r--cpp/src/tests/qpid_stream.cpp3
3 files changed, 6 insertions, 3 deletions
diff --git a/cpp/src/tests/qpid_recv.cpp b/cpp/src/tests/qpid_recv.cpp
index e4cc6a7ac8..10738578ed 100644
--- a/cpp/src/tests/qpid_recv.cpp
+++ b/cpp/src/tests/qpid_recv.cpp
@@ -148,8 +148,8 @@ int main(int argc, char ** argv)
{
Options opts;
if (opts.parse(argc, argv)) {
+ Connection connection(opts.connectionOptions);
try {
- Connection connection(opts.connectionOptions);
connection.open(opts.url);
std::auto_ptr<FailoverUpdates> updates(opts.failoverUpdates ? new FailoverUpdates(connection) : 0);
Session session = connection.newSession(opts.tx > 0);
@@ -207,6 +207,7 @@ int main(int argc, char ** argv)
return 0;
} catch(const std::exception& error) {
std::cerr << "Failure: " << error.what() << std::endl;
+ connection.close();
}
}
return 1;
diff --git a/cpp/src/tests/qpid_send.cpp b/cpp/src/tests/qpid_send.cpp
index 50e6c4371a..a8b0241a1d 100644
--- a/cpp/src/tests/qpid_send.cpp
+++ b/cpp/src/tests/qpid_send.cpp
@@ -181,8 +181,8 @@ int main(int argc, char ** argv)
{
Options opts;
if (opts.parse(argc, argv)) {
+ Connection connection(opts.connectionOptions);
try {
- Connection connection(opts.connectionOptions);
connection.open(opts.url);
std::auto_ptr<FailoverUpdates> updates(opts.failoverUpdates ? new FailoverUpdates(connection) : 0);
Session session = connection.newSession(opts.tx > 0);
@@ -230,6 +230,7 @@ int main(int argc, char ** argv)
return 0;
} catch(const std::exception& error) {
std::cout << "Failed: " << error.what() << std::endl;
+ connection.close();
}
}
return 1;
diff --git a/cpp/src/tests/qpid_stream.cpp b/cpp/src/tests/qpid_stream.cpp
index ef0aea52e4..5ed7f84492 100644
--- a/cpp/src/tests/qpid_stream.cpp
+++ b/cpp/src/tests/qpid_stream.cpp
@@ -87,8 +87,8 @@ struct Client : qpid::sys::Runnable
void run()
{
+ Connection connection;
try {
- Connection connection;
connection.open(opts.url);
Session session = connection.newSession();
doWork(session);
@@ -96,6 +96,7 @@ struct Client : qpid::sys::Runnable
connection.close();
} catch(const std::exception& error) {
std::cout << error.what() << std::endl;
+ connection.close();
}
}