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