Skip to content

Commit ed99d1d

Browse files
committed
Set delivery-count in 1st FLOW to client
"In the event that the receiving link endpoint has not yet seen the initial attach frame from the sender this field MUST NOT be set." [2.7.4] Since we (the server / the receiving link endpoint), have already seen the initial attach frame from the sender, set the delivery-count.
1 parent 68d0510 commit ed99d1d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

deps/rabbit/src/rabbit_amqp_session.erl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
%% queue_name_bin is only set if the link target address refers to a queue.
8080
queue_name_bin :: undefined | rabbit_misc:resource_name(),
8181
delivery_count :: sequence_no(),
82-
credit = 0 :: non_neg_integer(),
82+
credit :: non_neg_integer(),
8383
%% TRANSFER delivery IDs published to queues but not yet confirmed by queues
8484
incoming_unconfirmed_map = #{} :: #{delivery_number() =>
8585
{#{rabbit_amqqueue:name() := ok},
@@ -707,7 +707,8 @@ handle_control(#'v1_0.attach'{role = ?SEND_ROLE,
707707
source = Source,
708708
snd_settle_mode = SndSettleMode,
709709
target = Target,
710-
initial_delivery_count = ?UINT(DeliveryCount)} = Attach,
710+
initial_delivery_count = DeliveryCount = ?UINT(DeliveryCountInt)
711+
} = Attach,
711712
State0 = #state{incoming_links = IncomingLinks0,
712713
cfg = #cfg{vhost = Vhost,
713714
user = User}}) ->
@@ -718,7 +719,7 @@ handle_control(#'v1_0.attach'{role = ?SEND_ROLE,
718719
exchange = XName,
719720
routing_key = RoutingKey,
720721
queue_name_bin = QNameBin,
721-
delivery_count = DeliveryCount,
722+
delivery_count = DeliveryCountInt,
722723
credit = ?LINK_CREDIT_RCV},
723724
_Outcomes = outcomes(Source),
724725
OutputHandle = output_handle(InputHandle),
@@ -731,14 +732,10 @@ handle_control(#'v1_0.attach'{role = ?SEND_ROLE,
731732
target = Target,
732733
%% We are the receiver.
733734
role = ?RECV_ROLE,
734-
%% "ignored if the role is receiver"
735-
initial_delivery_count = undefined,
736735
max_message_size = {ulong, persistent_term:get(max_message_size)}},
737-
Flow = #'v1_0.flow'{
738-
handle = OutputHandle,
739-
link_credit = ?UINT(?LINK_CREDIT_RCV),
740-
drain = false,
741-
echo = false},
736+
Flow = #'v1_0.flow'{handle = OutputHandle,
737+
delivery_count = DeliveryCount,
738+
link_credit = ?UINT(?LINK_CREDIT_RCV)},
742739
%%TODO check that handle is not present in either incoming_links or outgoing_links:
743740
%%"The handle MUST NOT be used for other open links. An attempt to attach
744741
%% using a handle which is already associated with a link MUST be responded to

0 commit comments

Comments
 (0)