summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/console/Broker.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2008-12-23 19:38:25 +0000
committerTed Ross <tross@apache.org>2008-12-23 19:38:25 +0000
commit12d7d4125a42a7f0ab26a89c3c34e88135cf5869 (patch)
tree5970de22eb3027833688156a4116d71ef6b44442 /cpp/src/qpid/console/Broker.cpp
parent912a6db37456524c60e1b7f3236de4dca3c77636 (diff)
downloadqpid-python-12d7d4125a42a7f0ab26a89c3c34e88135cf5869.tar.gz
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
Diffstat (limited to 'cpp/src/qpid/console/Broker.cpp')
-rw-r--r--cpp/src/qpid/console/Broker.cpp11
1 files changed, 10 insertions, 1 deletions
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"));
}
}