Skip to content

Commit ad4e98d

Browse files
committed
improve: eliminate dialyzer warnings
1 parent 4c8462f commit ad4e98d

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

examples/active_n/recv_eprof.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ listen(How, Port) ->
5353

5454
accept(How, L) ->
5555
{ok, Sock} = gen_tcp:accept(L),
56-
case How of
56+
_ = case How of
5757
active_n ->
5858
inet:setopts(Sock, [{active, 100}]);
5959
async_recv -> ok

examples/client/echo_client.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ loop(Num, Sock) ->
6262
io:format("Client ~w unexpected: ~p", [Num, Other])
6363
after
6464
Timeout ->
65-
send(Num, Sock), loop(Num, Sock)
65+
_ = send(Num, Sock), loop(Num, Sock)
6666
end.
6767

6868
send(N, Sock) ->

examples/dtls_psk/dtls_psk_echo_server.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
-export([start_link/2, loop/2]).
2222

23+
-dialyzer({nowarn_function, [start/1]}).
24+
2325
start(Port) ->
24-
[{ok, _} = application:ensure_all_started(App) || App <- [sasl, crypto, ssl, esockd]],
26+
_ = [application:ensure_all_started(App) || App <- [sasl, crypto, ssl, esockd]],
2527
DtlsOpts = [{mode, binary}, {reuseaddr, true}] ++ psk_opts(),
2628
Opts = [{acceptors, 4}, {max_clients, 1000}, {dtls_options, DtlsOpts}],
2729
{ok, _} = esockd:open_dtls('echo/dtls', Port, Opts, {?MODULE, start_link, []}).

examples/plain/plain_echo_server.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ recvloop(Sock) ->
4949
{ok, Data} ->
5050
{ok, Peername} = inet:peername(Sock),
5151
io:format("Data from ~s: ~s~n", [esockd:format(Peername), Data]),
52-
gen_tcp:send(Sock, Data),
52+
_ = gen_tcp:send(Sock, Data),
5353
recvloop(Sock);
5454
{error, Reason} ->
5555
io:format("TCP closed for ~s~n", [Reason]),

examples/tcp_window/tcp_window.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ start(Port, How) when is_integer(Port) ->
3939
{shutdown, infinity},
4040
{max_connections, 100},
4141
{tcp_options, ?TCP_OPTIONS}],
42-
esockd:open(tcp_block, Port, Options, {?MODULE, start_server, [How]}),
42+
_ = esockd:open(tcp_block, Port, Options, {?MODULE, start_server, [How]}),
4343
start_client(Port).
4444

4545
start_server(Transport, Sock, How) ->
@@ -91,14 +91,14 @@ send_loop(Transport, Sock, SendFun, Data, Count) ->
9191
start_client(Port) ->
9292
case gen_tcp:connect("127.0.0.1", Port, ?TCP_OPTIONS, 60000) of
9393
{ok, Sock} ->
94-
inet:setopts(Sock, [{active, false}]),
94+
_ = inet:setopts(Sock, [{active, false}]),
9595
client_loop(Sock, 0);
9696
{error, Reason} ->
9797
io:format("client failed to connect: ~p~n", [Reason])
9898
end.
9999

100100
client_loop(Sock, I) ->
101-
gen_tcp:send(Sock, crypto:strong_rand_bytes(1024*1024)),
101+
_ = gen_tcp:send(Sock, crypto:strong_rand_bytes(1024*1024)),
102102
timer:sleep(1000),
103103
case gen_tcp:recv(Sock, 0) of
104104
{ok, Data} ->

rebar.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
{cover_opts, [verbose]}.
3737
{cover_export_enabled, true}.
3838

39-
{dialyzer, [{warnings, [unmatched_returns, error_handling, race_conditions]}]}.
39+
{dialyzer, [{warnings, [unmatched_returns,
40+
error_handling,
41+
race_conditions]}]}.
4042

4143
{profiles,
4244
[{test,

src/esockd_dtls_acceptor.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ accepting(internal, accept,
8686
%% Inc accepted stats.
8787
StatsFun({inc, 1}),
8888

89-
case TuneFun(Sock) of
89+
_ = case TuneFun(Sock) of
9090
{ok, Sock} ->
9191
case esockd_connection_sup:start_connection(ConnSup, Sock, UpgradeFuns) of
9292
{ok, _Pid} -> ok;

0 commit comments

Comments
 (0)