summaryrefslogtreecommitdiff
path: root/cpp/lib/client
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-01-18 06:27:50 +0000
committerAlan Conway <aconway@apache.org>2007-01-18 06:27:50 +0000
commit9e8a7c77a94a92c6cf92cf60be508817f0778040 (patch)
tree0ff1882596aae1da3fd6bd6c2b4e13a3b9ae5de7 /cpp/lib/client
parent762cba1e7db15cb3c9e987a9edcbf3106c7244cb (diff)
downloadqpid-python-9e8a7c77a94a92c6cf92cf60be508817f0778040.tar.gz
There are a ton of FIXMES and request/response IDs are not yet working fully
but all tests are passing. * broker::Broker: Removed requester/responder from broker. * framing::BodyHandler: added Requester/Responder to BodyHandler, becomes the base class for channel adapters in broker and client. * broker::BrokerAdapter: Inherit BodyHandler, wraps a broker::Channel. Hide private *HandlerImpl detail classes in BodyHandler.cpp. * broker::Connection: Requester/Responder/Adapter now per-channel. Connection channel map replaced with adapter map of BrokerAdapters. handle* functions moved to BrokerAdapter. All methods now handled by a BrokerAdapter for the relevant channel. ChannelHandlerImpl is repsonsible for checking that - No method on a non-0 channel is processed before open() - Channel 0 methods only happen on channel 0 and similar for non-zero methods Checks are not yet complete (see FIXMES) * client::ResponseHandler: fix for client hang if broker crashs. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@497319 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/client')
-rw-r--r--cpp/lib/client/Connection.cpp1
-rw-r--r--cpp/lib/client/ResponseHandler.cpp14
2 files changed, 8 insertions, 7 deletions
diff --git a/cpp/lib/client/Connection.cpp b/cpp/lib/client/Connection.cpp
index 10a0b50aad..dd1e372095 100644
--- a/cpp/lib/client/Connection.cpp
+++ b/cpp/lib/client/Connection.cpp
@@ -253,4 +253,5 @@ void Connection::shutdown(){
for(iterator i = channels.begin(); i != channels.end(); i++){
i->second->stop();
}
+ responses.signalResponse(AMQMethodBody::shared_ptr());
}
diff --git a/cpp/lib/client/ResponseHandler.cpp b/cpp/lib/client/ResponseHandler.cpp
index ac8b4a9ced..68c7e52013 100644
--- a/cpp/lib/client/ResponseHandler.cpp
+++ b/cpp/lib/client/ResponseHandler.cpp
@@ -29,28 +29,28 @@ qpid::client::ResponseHandler::ResponseHandler() : waiting(false){}
qpid::client::ResponseHandler::~ResponseHandler(){}
bool qpid::client::ResponseHandler::validate(const qpid::framing::AMQMethodBody& expected){
- return expected.match(response.get());
+ return response != 0 && expected.match(response.get());
}
void qpid::client::ResponseHandler::waitForResponse(){
Monitor::ScopedLock l(monitor);
- if(waiting){
+ while (waiting)
monitor.wait();
- }
}
-void qpid::client::ResponseHandler::signalResponse(qpid::framing::AMQMethodBody::shared_ptr _response){
- response = _response;
+void qpid::client::ResponseHandler::signalResponse(
+ qpid::framing::AMQMethodBody::shared_ptr _response)
+{
Monitor::ScopedLock l(monitor);
+ response = _response;
waiting = false;
monitor.notify();
}
void qpid::client::ResponseHandler::receive(const qpid::framing::AMQMethodBody& expected){
Monitor::ScopedLock l(monitor);
- if(waiting){
+ while (waiting)
monitor.wait();
- }
if(!validate(expected)){
THROW_QPID_ERROR(PROTOCOL_ERROR, "Protocol Error");
}