diff options
Diffstat (limited to 'cpp/src/qpid/framing/AMQFrame.cpp')
-rw-r--r-- | cpp/src/qpid/framing/AMQFrame.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cpp/src/qpid/framing/AMQFrame.cpp b/cpp/src/qpid/framing/AMQFrame.cpp index 780af71be4..a7fd068ee4 100644 --- a/cpp/src/qpid/framing/AMQFrame.cpp +++ b/cpp/src/qpid/framing/AMQFrame.cpp @@ -70,7 +70,7 @@ const AMQBody* AMQFrame::getBody() const { return boost::apply_visitor(GetBodyVisitor(), const_cast<Variant&>(body)); } -void AMQFrame::encode(Buffer& buffer) +void AMQFrame::encode(Buffer& buffer) const { buffer.putOctet(getBody()->type()); buffer.putShort(channel); @@ -80,8 +80,11 @@ void AMQFrame::encode(Buffer& buffer) } uint32_t AMQFrame::size() const{ - return 1/*type*/ + 2/*channel*/ + 4/*body size*/ + - boost::apply_visitor(SizeVisitor(), body) + 1/*0xCE*/; + return frameOverhead() + boost::apply_visitor(SizeVisitor(), body); +} + +uint32_t AMQFrame::frameOverhead() { + return 1/*type*/ + 2/*channel*/ + 4/*body size*/ + 1/*0xCE*/; } bool AMQFrame::decode(Buffer& buffer) |