From 12d7d4125a42a7f0ab26a89c3c34e88135cf5869 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Tue, 23 Dec 2008 19:38:25 +0000 Subject: QPID-1412 Updates and fixes for the c++ console API: - Added event support - Converted raw pointers to shared_ptrs in references to Values. This fixes a memory leak in the original code. - Added wrappers to make value access more convenient. - Added timeout handling for synchronous operations. Timeout values are configurable. - Fixed a bug in getObjects whereby waitForStable was not called and the operation could fail if called too early. - Added examples "printevents" and "ping" to illustrate the usage of different aspects of the API. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@729075 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/console/Broker.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/console/Broker.cpp') diff --git a/cpp/src/qpid/console/Broker.cpp b/cpp/src/qpid/console/Broker.cpp index 2e7ba95b1d..c6b1be1d31 100644 --- a/cpp/src/qpid/console/Broker.cpp +++ b/cpp/src/qpid/console/Broker.cpp @@ -59,6 +59,13 @@ Broker::~Broker() { } +string Broker::getUrl() const +{ + stringstream url; + url << connectionSettings.host << ":" << connectionSettings.port; + return url.str(); +} + void Broker::encodeHeader(framing::Buffer& buf, uint8_t opcode, uint32_t seq) const { buf.putOctet('A'); @@ -249,7 +256,9 @@ void Broker::waitForStable() return; syncInFlight = true; while (reqsOutstanding != 0) { - cond.wait(lock); // TODO: put timeout delay in here! + bool result = cond.wait(lock, AbsTime(now(), TIME_SEC * sessionManager.settings.getTimeout)); + if (!result) + throw(Exception("Timed out waiting for broker to synchronize")); } } -- cgit v1.2.1