Skip to content

Commit 567ddb8

Browse files
ansdmichaelklishin
authored andcommitted
Fix splitting large messages in AMQP client
This commit fixes the failing test cases ``` make -C deps/rabbit ct-msg_size_metrics t=tests:message_size make -C deps/amqp10_client ct-system t=rabbitmq:roundtrip_large_messages ``` The second test case failed with: ``` flush {amqp10_event, {connection,<0.193.0>, {closed, {framing_error, <<"frame size (131073 bytes) > maximum frame size (131072 bytes)">>}}}} ```
1 parent c92df5b commit 567ddb8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

deps/amqp10_client/src/amqp10_client_session.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,8 @@ send_transfer(Transfer0, Sections0, FooterOpt, MaxMessageSize,
625625
channel = Channel,
626626
connection_config = Config}) ->
627627
OutMaxFrameSize = maps:get(outgoing_max_frame_size, Config),
628-
Transfer = amqp10_framing:encode_bin(Transfer0),
629-
TransferSize = iolist_size(Transfer),
628+
Transfer = Transfer0#'v1_0.transfer'{more = false},
629+
TransferSize = iolist_size(amqp10_framing:encode_bin(Transfer)),
630630
Sections = encode_sections(Sections0, FooterOpt),
631631
SectionsBin = iolist_to_binary(Sections),
632632
if is_integer(MaxMessageSize) andalso
@@ -637,7 +637,7 @@ send_transfer(Transfer0, Sections0, FooterOpt, MaxMessageSize,
637637
% TODO: this does not take the extended header into account
638638
% see: 2.3
639639
MaxPayloadSize = OutMaxFrameSize - TransferSize - ?FRAME_HEADER_SIZE,
640-
Frames = build_frames(Channel, Transfer0, SectionsBin, MaxPayloadSize, []),
640+
Frames = build_frames(Channel, Transfer, SectionsBin, MaxPayloadSize, []),
641641
ok = socket_send(Socket, Frames),
642642
{ok, length(Frames)}
643643
end.
@@ -722,7 +722,7 @@ set_flow_session_fields(Flow, #state{next_incoming_id = NID,
722722

723723
build_frames(Channel, Trf, Bin, MaxPayloadSize, Acc)
724724
when byte_size(Bin) =< MaxPayloadSize ->
725-
T = amqp10_framing:encode_bin(Trf#'v1_0.transfer'{more = false}),
725+
T = amqp10_framing:encode_bin(Trf),
726726
Frame = amqp10_binary_generator:build_frame(Channel, [T, Bin]),
727727
lists:reverse([Frame | Acc]);
728728
build_frames(Channel, Trf, Payload, MaxPayloadSize, Acc) ->

0 commit comments

Comments
 (0)