[rabbitmq-discuss] encoding content body frames

Aman Gupta rabbitmq at tmm1.net
Tue Jul 15 00:32:07 BST 2008


The amqp0-8.pdf spec states:

The content body payload is an opaque binary block followed by a frame
end octet:

+-----------------------+ +-----------+

| Opaque binary payload | | frame-end |

+-----------------------+ +-----------+


However, sending the extra frame-end octet with the content causes rabbitmq
to get "stuck". In fact, this occurs anytime rabbitmq reads more content
data than it is expecting. Here is a naive patch to ignore extra content in
the body frame:


diff -r 2453e5783900 src/rabbit_framing_channel.erl

--- a/src/rabbit_framing_channel.erl Tue Jul 08 12:16:59 2008 +0100

+++ b/src/rabbit_framing_channel.erl Mon Jul 14 16:31:03 2008 -0700

@@ -101,6 +101,10 @@



 collect_content_payload(_ChannelPid, 0, Acc) ->

     Acc;

+collect_content_payload(_ChannelPid, RemainingByteCount, Acc) when
RemainingByteCount < 0 ->

+    Content = list_to_binary(Acc),

+    {Ret, _} = split_binary(Content, size(Content) + RemainingByteCount),

+    [Ret];

 collect_content_payload(ChannelPid, RemainingByteCount, Acc) ->

     case read_frame(ChannelPid) of

         {content_body, FragmentBin} ->


  Aman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080714/52ee2ee8/attachment.htm 


More information about the rabbitmq-discuss mailing list