summaryrefslogtreecommitdiff
path: root/cpp/lib/client/ResponseHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/lib/client/ResponseHandler.cpp')
-rw-r--r--cpp/lib/client/ResponseHandler.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/cpp/lib/client/ResponseHandler.cpp b/cpp/lib/client/ResponseHandler.cpp
index ea48fa2386..4498de41ae 100644
--- a/cpp/lib/client/ResponseHandler.cpp
+++ b/cpp/lib/client/ResponseHandler.cpp
@@ -59,11 +59,8 @@ void ResponseHandler::receive(ClassId c, MethodId m) {
Monitor::ScopedLock l(monitor);
while (waiting)
monitor.wait();
- if (!response) {
- THROW_QPID_ERROR(
- PROTOCOL_ERROR, "Channel closed unexpectedly.");
- }
- if(!validate(response->amqpClassId(), response->amqpMethodId())) {
+ getResponse(); // Check for closed.
+ if(!validate(response->amqpClassId(), response->amqpMethodId())) {
THROW_QPID_ERROR(
PROTOCOL_ERROR,
boost::format("Expected class:method %d:%d, got %d:%d")
@@ -71,6 +68,13 @@ void ResponseHandler::receive(ClassId c, MethodId m) {
}
}
+framing::AMQMethodBody::shared_ptr ResponseHandler::getResponse() {
+ if (!response)
+ THROW_QPID_ERROR(
+ PROTOCOL_ERROR, "Channel closed unexpectedly.");
+ return response;
+}
+
RequestId ResponseHandler::getRequestId() {
assert(response->getRequestId());
return response->getRequestId();