summaryrefslogtreecommitdiff
path: root/cpp/lib
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/lib')
-rw-r--r--cpp/lib/broker/Connection.cpp2
-rw-r--r--cpp/lib/common/framing/ChannelAdapter.cpp6
-rw-r--r--cpp/lib/common/framing/MethodContext.h18
3 files changed, 17 insertions, 9 deletions
diff --git a/cpp/lib/broker/Connection.cpp b/cpp/lib/broker/Connection.cpp
index 5fcae39865..b45aa375e6 100644
--- a/cpp/lib/broker/Connection.cpp
+++ b/cpp/lib/broker/Connection.cpp
@@ -74,7 +74,7 @@ void Connection::initiated(qpid::framing::ProtocolInitiation* header) {
string locales("en_US");
// TODO aconway 2007-01-16: Client call, move to adapter.
client->getConnection().start(
- MethodContext(0, 0, &getAdapter(0)),
+ MethodContext(0, &getAdapter(0)),
header->getMajor(), header->getMinor(),
properties, mechanisms, locales);
getAdapter(0).init(0, *out, client->getProtocolVersion());
diff --git a/cpp/lib/common/framing/ChannelAdapter.cpp b/cpp/lib/common/framing/ChannelAdapter.cpp
index ce59cbd0cc..225e5e3393 100644
--- a/cpp/lib/common/framing/ChannelAdapter.cpp
+++ b/cpp/lib/common/framing/ChannelAdapter.cpp
@@ -32,7 +32,7 @@ void ChannelAdapter::init(
id = i;
out = &o;
version = v;
- context = MethodContext(0, id, this);
+ context = MethodContext(id, this);
}
void ChannelAdapter::send(AMQFrame* frame) {
@@ -62,7 +62,7 @@ void ChannelAdapter::send(AMQBody::shared_ptr body) {
void ChannelAdapter::handleRequest(AMQRequestBody::shared_ptr request) {
assertMethodOk(*request);
responder.received(request->getData());
- context =MethodContext(request.get(), id, this, request->getRequestId());
+ context =MethodContext(id, request, this, request->getRequestId());
handleMethodInContext(request, context);
}
@@ -76,7 +76,7 @@ void ChannelAdapter::handleResponse(AMQResponseBody::shared_ptr response) {
void ChannelAdapter::handleMethod(AMQMethodBody::shared_ptr method) {
assertMethodOk(*method);
- context = MethodContext(method.get(), id, this);
+ context = MethodContext(id, method, this);
handleMethodInContext(method, context);
}
diff --git a/cpp/lib/common/framing/MethodContext.h b/cpp/lib/common/framing/MethodContext.h
index 54e05f0fb2..454025e377 100644
--- a/cpp/lib/common/framing/MethodContext.h
+++ b/cpp/lib/common/framing/MethodContext.h
@@ -22,6 +22,8 @@
#include "OutputHandler.h"
#include "ProtocolVersion.h"
+#include <boost/shared_ptr.hpp>
+
namespace qpid {
namespace framing {
@@ -46,11 +48,17 @@ struct MethodContext
* Passing a integer channel-id in place of a MethodContext
* will automatically construct the MethodContext.
*/
- MethodContext(
- const AMQMethodBody* method,
- ChannelId channel, OutputHandler* output=0, RequestId request=0)
+ MethodContext(ChannelId channel,
+ OutputHandler* output=0, RequestId request=0)
+ : channelId(channel), out(output), requestId(request)
+ {}
+
+ MethodContext(ChannelId channel,
+ boost::shared_ptr<AMQMethodBody> method,
+ OutputHandler* output=0, RequestId request=0)
: channelId(channel), out(output), requestId(request),
- methodBody(method) {}
+ methodBody(method)
+ {}
/** \internal Channel on which the method is sent. */
ChannelId channelId;
@@ -66,7 +74,7 @@ struct MethodContext
/** \internal This is the Method Body itself
* It's useful for passing around instead of unpacking all its parameters
*/
- const AMQMethodBody* methodBody;
+ boost::shared_ptr<AMQMethodBody> methodBody;
};
}} // namespace qpid::framing