diff options
author | Ted Ross <tross@apache.org> | 2009-06-08 20:23:19 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2009-06-08 20:23:19 +0000 |
commit | 87d3337eefa96eceeb0247039b0738352ef91130 (patch) | |
tree | 6fce254c404993e0f2d651b58830f31b238907b7 /cpp/examples/qmf-console | |
parent | 5fe7eb38df0c0e205e9663ac6056aeef2ac0bc8b (diff) | |
download | qpid-python-87d3337eefa96eceeb0247039b0738352ef91130.tar.gz |
Bugfixes in the c++ console API:
- Connection threads now shut down cleanly
- get-query timeouts now work properly
- waitForStable now only waits for connected brokers
The ping example was improved. It now more cleanly handles connection loss/reconnect.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@782766 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/examples/qmf-console')
-rw-r--r-- | cpp/examples/qmf-console/ping.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/cpp/examples/qmf-console/ping.cpp b/cpp/examples/qmf-console/ping.cpp index 39ec0d3039..405c15f1c4 100644 --- a/cpp/examples/qmf-console/ping.cpp +++ b/cpp/examples/qmf-console/ping.cpp @@ -43,6 +43,7 @@ int main_int(int /*argc*/, char** /*argv*/) // SessionManager::Settings smSettings; smSettings.methodTimeout = 2; + smSettings.getTimeout = 2; // // Declare the console session manager. With a null listener argument, it defaults to @@ -58,18 +59,21 @@ int main_int(int /*argc*/, char** /*argv*/) uint32_t count = 5; // The number of echo requests we will send to the broker. Object::Vector list; // A container for holding objects retrieved from the broker. - // - // Query for a list of 'broker' objects from the Management Database - // - sm.getObjects(list, "broker"); + for (uint32_t iter = 0; iter < count; iter++) { + cout << "Ping Broker: " << broker->getUrl() << "... "; + cout.flush(); - // - // We expect one object (since we are connected to only one broker) - // - if (list.size() == 1) { - Object& brokerObject = *(list.begin()); + // + // Query for a list of 'broker' objects from the Management Database + // + sm.getObjects(list, "broker"); + + // + // We expect one object (since we are connected to only one broker) + // + if (list.size() == 1) { + Object& brokerObject = *(list.begin()); - for (uint32_t iter = 0; iter < count; iter++) { // // Declare a container for arguments to be sent with the "echo" method // that we will invoke on the remote "broker" object. @@ -87,9 +91,6 @@ int main_int(int /*argc*/, char** /*argv*/) args.addUint("sequence", iter); args.addString("body", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - cout << "Ping Broker: " << broker->getUrl() << "... "; - cout.flush(); - // // Invoke the method. This is a synchronous operation that will block until // the method completes and returns a result. @@ -109,6 +110,9 @@ int main_int(int /*argc*/, char** /*argv*/) if (result.code == 0 && iter < count - 1) qpid::sys::sleep(1); + } else { + cout << "Disconnected..." << endl; + qpid::sys::sleep(1); } } |