diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_binary_generator.erl | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl index 07f25c15c0..f0ec618044 100644 --- a/src/rabbit_binary_generator.erl +++ b/src/rabbit_binary_generator.erl @@ -85,31 +85,18 @@ build_simple_method_frame(ChannelInt, MethodRecord, Protocol) -> {ClassId, MethodId} = Protocol:method_id(MethodName), create_frame(1, ChannelInt, [<<ClassId:16, MethodId:16>>, MethodFields]). -build_simple_content_frames(ChannelInt, - #content{class_id = ClassId, - properties = ContentProperties, - properties_bin = ContentPropertiesBin, - protocol = ContentProtocol, - payload_fragments_rev = PayloadFragmentsRev}, - FrameMax, Protocol) -> - {BodySize, ContentFrames} = build_content_frames(PayloadFragmentsRev, FrameMax, ChannelInt), +build_simple_content_frames(ChannelInt, Content, FrameMax, Protocol) -> + #content{class_id = ClassId, + properties_bin = ContentPropertiesBin, + payload_fragments_rev = PayloadFragmentsRev} = + ensure_content_encoded(Content, Protocol), + {BodySize, ContentFrames} = + build_content_frames(PayloadFragmentsRev, FrameMax, ChannelInt), HeaderFrame = create_frame(2, ChannelInt, [<<ClassId:16, 0:16, BodySize:64>>, - maybe_encode_properties(ContentProperties, - ContentPropertiesBin, - ContentProtocol, - Protocol)]), + ContentPropertiesBin]), [HeaderFrame | ContentFrames]. -maybe_encode_properties(_ContentProperties, - ContentPropertiesBin, - Protocol, - Protocol) - when is_binary(ContentPropertiesBin) -> - ContentPropertiesBin; -maybe_encode_properties(ContentProperties, none, _ContentProtocol, Protocol) -> - Protocol:encode_properties(ContentProperties). - build_content_frames(FragsRev, FrameMax, ChannelInt) -> BodyPayloadMax = if FrameMax == 0 -> iolist_size(FragsRev); |
