qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: A small code puzzler (for me)
Date Fri, 07 Sep 2007 14:38:05 GMT
Andrew Stitcher wrote:
> Just looking at current framing::Buffer usage in the broker.
> A quick question about RecoveryManagerImpl.cpp:110
> RecoverableMessage::shared_ptr
> RecoveryManagerImpl::recoverMessage(framing::Buffer& buffer)
> {
> -->
>     buffer.record();
> <--
>     //peek at type:
>     Message::shared_ptr message(new Message());
>     message->decodeHeader(buffer);
>     return RecoverableMessage::shared_ptr(new
> RecoverableMessageImpl(message, stagingThreshold));    
> }
> the line is - buffer.record();
> I can't see anywhere else in the class that buffer.restore() is called
> so I'm wondering why buffer.record() is called.

My bad! That line should no longer be there.

Previously there were two different classes of message (corresponding to 
the different AMQP classes Basic and Message). They were encoded in the 
store in different ways, with a type discriminator written first. Th 
code in this method used to peek at the type before deciding which class 
to use for the decode.

Now there is a single class used in each case and the type discriminator 
is no longer read or written. I obviously omitted to remove the record 
which is not needed and looks confusing!

View raw message