Skip to content

Commit 4cdc93a

Browse files
Apply feedback from @ansd
1 parent 9218723 commit 4cdc93a

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

deps/amqp10_client/src/amqp10_client.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
end_session/1,
2020
attach_sender_link/3,
2121
attach_sender_link/4,
22-
attach_sender_link/5,
22+
attach_sender_link/5,
2323
attach_sender_link_sync/3,
2424
attach_sender_link_sync/4,
2525
attach_sender_link_sync/5,
@@ -164,10 +164,10 @@ end_session(Pid) ->
164164
%% @doc Synchronously attach a link on 'Session'.
165165
%% This is a convenience function that awaits attached event
166166
%% for the link before returning.
167-
attach_sender_link_sync(Session, Name, Target) ->
168-
attach_sender_link_sync(Session, Name, Target, mixed).
169167
-spec attach_sender_link_sync(pid(), binary(), binary()) ->
170168
{ok, link_ref()} | link_timeout.
169+
attach_sender_link_sync(Session, Name, Target) ->
170+
attach_sender_link_sync(Session, Name, Target, mixed).
171171

172172
%% @doc Synchronously attach a link on 'Session'.
173173
%% This is a convenience function that awaits attached event

deps/amqp10_client/src/amqp10_client_session.erl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
-type rcv_settle_mode() :: first | second.
7474

7575
-type terminus_durability() :: none | configuration | unsettled_state.
76-
-type terminus_capabilities() :: none | binary() | list().
76+
-type terminus_capabilities() :: binary() | [binary(),...].
7777

7878
-type target_def() :: #{address => link_address(),
7979
durable => terminus_durability(),
@@ -112,7 +112,6 @@
112112
-export_type([snd_settle_mode/0,
113113
rcv_settle_mode/0,
114114
terminus_durability/0,
115-
terminus_capabilities/0,
116115
attach_args/0,
117116
attach_role/0,
118117
target_def/0,
@@ -779,18 +778,16 @@ filter_value_type({T, _} = V) when is_atom(T) ->
779778
%% looks like an already tagged type, just pass it through
780779
V.
781780

782-
translate_terminus_capabilities(none) ->
783-
undefined;
784781
translate_terminus_capabilities(Capabilities) when is_binary(Capabilities) ->
785782
{symbol, Capabilities};
786783
translate_terminus_capabilities(CapabilitiesList) when is_list(CapabilitiesList) ->
787784
{array, symbol, [filter_capability(V) || V <- CapabilitiesList]}.
788785

789786
filter_capability(V) when is_binary(V) ->
790787
{symbol, V};
791-
filter_capability({T, _} = V) when is_atom(T) ->
792-
%% looks like an already tagged type, just pass it through
793-
V.
788+
filter_capability(_) ->
789+
%% Any other type is ignored
790+
{}.
794791

795792
% https://people.apache.org/~rgodfrey/amqp-1.0/apache-filters.html
796793
translate_legacy_amqp_headers_binding(LegacyHeaders) ->

deps/amqp10_client/test/system_SUITE.erl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ open_close_connection(Config) ->
209209
{amqp10_event, {connection, Connection2, opened}} -> ct:log("connection opened"), ok
210210
after 5000 -> exit(connection_timeout)
211211
end,
212-
ct:log("Closing connection ..."),
213212
ok = amqp10_client:close_connection(Connection2),
214213
ct:log("Closed connection .").
215214

@@ -277,7 +276,7 @@ open_connection_plain_sasl_failure(Config) ->
277276
ok = amqp10_client:close_connection(Connection).
278277

279278
basic_roundtrip(Config) ->
280-
application:start(sasl),
279+
application:start(sasl),
281280
Hostname = ?config(rmq_hostname, Config),
282281
Port = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_amqp),
283282
OpenConf = #{address => Hostname, port => Port, sasl => ?config(sasl, Config)},
@@ -389,7 +388,6 @@ roundtrip(OpenConf, Args) ->
389388
properties => #{}
390389
},
391390
{ok, Sender} = amqp10_client:attach_link(Session, SenderAttachArgs),
392-
%%await_link(Sender, credited, link_credit_timeout),
393391
await_link(Sender, attached, attached_timeout),
394392

395393
Now = os:system_time(millisecond),
@@ -427,7 +425,8 @@ roundtrip(OpenConf, Args) ->
427425

428426
% ct:pal(?LOW_IMPORTANCE, "roundtrip message Out: ~tp~nIn: ~tp~n", [OutMsg, Msg]),
429427
ActualProps = amqp10_msg:properties(OutMsg),
430-
[ ?assertEqual(V, maps:get(K, ActualProps)) || K := V <- Props, K =/= creation_time],
428+
% [ ?assertEqual(V, maps:get(K, ActualProps)) || K := V <- Props, K =/= creation_time],
429+
[ ?assertEqual(V, maps:get(K, ActualProps)) || K := V <- Props],
431430

432431
?assertEqual(#{<<"a_key">> => <<"a_value">>}, amqp10_msg:application_properties(OutMsg)),
433432
ActualMessageAnnotations = amqp10_msg:message_annotations(OutMsg),
@@ -437,17 +436,14 @@ roundtrip(OpenConf, Args) ->
437436
ok.
438437

439438
filtered_roundtrip(OpenConf) ->
440-
filtered_roundtrip(OpenConf, []).
441-
442-
filtered_roundtrip(OpenConf, Args) ->
443-
Body = proplists:get_value(body, Args, <<"banana">>),
444-
Destination = proplists:get_value(destination, Args, <<"test1">>),
439+
filtered_roundtrip(OpenConf, <<"test1">>).
445440

441+
filtered_roundtrip(OpenConf, Body) ->
446442
{ok, Connection} = amqp10_client:open_connection(OpenConf),
447443
{ok, Session} = amqp10_client:begin_session(Connection),
448444
{ok, Sender} = amqp10_client:attach_sender_link(Session,
449445
<<"default-sender">>,
450-
Destination,
446+
<<"test1">>,
451447
settled,
452448
unsettled_state),
453449
await_link(Sender, credited, link_credit_timeout),

0 commit comments

Comments
 (0)