Corrections for various dialyzer warnings
This commit is contained in:
parent
015a3ff00c
commit
f46bac3d8b
|
@ -63,7 +63,9 @@
|
|||
address => address(),
|
||||
port => inet:port_number(),
|
||||
tls_opts => {secure_port, [ssl:ssl_option()]},
|
||||
notify => pid(), % the pid to send connection events to
|
||||
notify => pid() | none, % the pid to send connection events to
|
||||
notify_when_opened => pid() | none,
|
||||
notify_when_closed => pid() | none,
|
||||
max_frame_size => non_neg_integer(), % TODO: constrain to large than 512
|
||||
outgoing_max_frame_size => non_neg_integer() | undefined,
|
||||
idle_time_out => milliseconds(),
|
||||
|
@ -390,15 +392,17 @@ send_heartbeat(#state{socket = Socket}) ->
|
|||
Frame = amqp10_binary_generator:build_heartbeat_frame(),
|
||||
socket_send(Socket, Frame).
|
||||
|
||||
-dialyzer({no_fail_call, socket_send/2}).
|
||||
socket_send({tcp, Socket}, Data) ->
|
||||
gen_tcp:send(Socket, Data);
|
||||
socket_send({ssl, Socket}, Data) ->
|
||||
ssl:send(Socket, Data).
|
||||
|
||||
socket_shutdown({tcp, Socket}, Data) ->
|
||||
gen_tcp:shutdown(Socket, Data);
|
||||
socket_shutdown({ssl, Socket}, Data) ->
|
||||
ssl:shutdown(Socket, Data).
|
||||
-dialyzer({no_match, socket_shutdown/2}).
|
||||
socket_shutdown({tcp, Socket}, How) ->
|
||||
gen_tcp:shutdown(Socket, How);
|
||||
socket_shutdown({ssl, Socket}, How) ->
|
||||
ssl:shutdown(Socket, How).
|
||||
|
||||
notify_opened(#{notify_when_opened := none}) ->
|
||||
ok;
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
buffer = <<>> :: binary(),
|
||||
frame_state :: #frame_state{} | undefined,
|
||||
connection :: pid() | undefined,
|
||||
heartbeat_timer_ref :: timer:tref() | undefined,
|
||||
heartbeat_timer_ref :: reference() | undefined,
|
||||
connection_config = #{} :: amqp10_client_connection:connection_config(),
|
||||
outgoing_channels = #{},
|
||||
incoming_channels = #{}}).
|
||||
|
@ -218,11 +218,13 @@ code_change(_OldVsn, StateName, State, _Extra) ->
|
|||
%% Internal functions.
|
||||
%% -------------------------------------------------------------------
|
||||
|
||||
-dialyzer({no_fail_call, close_socket/1}).
|
||||
close_socket({tcp, Socket}) ->
|
||||
gen_tcp:close(Socket);
|
||||
close_socket({ssl, Socket}) ->
|
||||
ssl:close(Socket).
|
||||
|
||||
-dialyzer({no_fail_call, set_active_once/1}).
|
||||
set_active_once(#state{socket = {tcp, Socket}}) ->
|
||||
ok = inet:setopts(Socket, [{active, once}]);
|
||||
set_active_once(#state{socket = {ssl, Socket}}) ->
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
role => attach_role(),
|
||||
snd_settle_mode => snd_settle_mode(),
|
||||
rcv_settle_mode => rcv_settle_mode(),
|
||||
filter => filter()
|
||||
filter => filter(),
|
||||
properties => properties()
|
||||
}.
|
||||
|
||||
-type link_ref() :: #link_ref{}.
|
||||
|
@ -183,7 +184,8 @@ begin_sync(Connection, Timeout) ->
|
|||
|
||||
-spec attach(pid(), attach_args()) -> {ok, link_ref()}.
|
||||
attach(Session, Args) ->
|
||||
gen_fsm:sync_send_event(Session, {attach, Args}).
|
||||
{ok, LinkRef} = gen_fsm:sync_send_event(Session, {attach, Args}),
|
||||
{ok, LinkRef}.
|
||||
|
||||
-spec detach(pid(), link_handle()) -> ok | {error, link_not_found | half_attached}.
|
||||
detach(Session, Handle) ->
|
||||
|
@ -982,6 +984,7 @@ socket_send(Sock, Data) ->
|
|||
{error, Reason} -> exit({socket_closed, Reason})
|
||||
end.
|
||||
|
||||
-dialyzer({no_fail_call, socket_send0/2}).
|
||||
socket_send0({tcp, Socket}, Data) ->
|
||||
gen_tcp:send(Socket, Data);
|
||||
socket_send0({ssl, Socket}, Data) ->
|
||||
|
|
|
@ -284,14 +284,14 @@ body_bin_data(_) ->
|
|||
#'v1_0.data'{content = <<"one">>},
|
||||
#'v1_0.data'{content = <<"two">>}
|
||||
],
|
||||
Msg = amqp10_msg:new(55, Body),
|
||||
Msg = amqp10_msg:new(<<55>>, Body),
|
||||
Bin = amqp10_msg:body_bin(Msg),
|
||||
Body = amqp10_framing:decode_bin(Bin),
|
||||
ok.
|
||||
|
||||
body_bin_amqp_value(_) ->
|
||||
Body = #'v1_0.amqp_value'{content = {utf8, <<"one">>}},
|
||||
Msg = amqp10_msg:new(55, Body),
|
||||
Msg = amqp10_msg:new(<<55>>, Body),
|
||||
Bin = amqp10_msg:body_bin(Msg),
|
||||
[Body] = amqp10_framing:decode_bin(Bin),
|
||||
ok.
|
||||
|
@ -302,7 +302,7 @@ body_bin_amqp_sequence(_) ->
|
|||
{utf8, <<"blah">>}]},
|
||||
#'v1_0.amqp_sequence'{content = [{utf8, <<"two">>}]}
|
||||
],
|
||||
Msg = amqp10_msg:new(55, Body),
|
||||
Msg = amqp10_msg:new(<<55>>, Body),
|
||||
Bin = amqp10_msg:body_bin(Msg),
|
||||
Body = amqp10_framing:decode_bin(Bin),
|
||||
ok.
|
||||
|
|
Loading…
Reference in New Issue