aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet_res.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/src/inet_res.erl')
-rw-r--r--lib/kernel/src/inet_res.erl33
1 files changed, 20 insertions, 13 deletions
diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl
index 94a9f7c64d..6037da1d22 100644
--- a/lib/kernel/src/inet_res.erl
+++ b/lib/kernel/src/inet_res.erl
@@ -139,7 +139,7 @@ resolve(Name, Class, Type, Opts, Timeout) ->
{ok, Nm} ->
Timer = inet:start_timer(Timeout),
Res = res_query(Nm, Class, Type, Opts, Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res;
Error ->
Error
@@ -339,7 +339,7 @@ gethostbyaddr(IP) -> gethostbyaddr_tm(IP,false).
gethostbyaddr(IP,Timeout) ->
Timer = inet:start_timer(Timeout),
Res = gethostbyaddr_tm(IP,Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res.
gethostbyaddr_tm({A,B,C,D} = IP, Timer) when ?ip(A,B,C,D) ->
@@ -424,7 +424,7 @@ gethostbyname(Name,Family) ->
gethostbyname(Name,Family,Timeout) ->
Timer = inet:start_timer(Timeout),
Res = gethostbyname_tm(Name,Family,Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res.
gethostbyname_tm(Name,inet,Timer) ->
@@ -483,7 +483,7 @@ getbyname(Name, Type) ->
getbyname(Name, Type, Timeout) ->
Timer = inet:start_timer(Timeout),
Res = getbyname_tm(Name, Type, Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res.
getbyname_tm(Name, Type, Timer) when is_list(Name) ->
@@ -921,18 +921,25 @@ query_tcp(Timeout, Id, Buffer, IP, Port, Verbose) ->
[{active,false},{packet,2},binary,Family],
Timeout) of
{ok, S} ->
- gen_tcp:send(S, Buffer),
- case gen_tcp:recv(S, 0, Timeout) of
- {ok, Answer} ->
- gen_tcp:close(S),
- case decode_answer(Answer, Id, Verbose) of
- {ok, _} = OK -> OK;
- {error, badid} -> {error, servfail};
- Error -> Error
+ case gen_tcp:send(S, Buffer) of
+ ok ->
+ case gen_tcp:recv(S, 0, Timeout) of
+ {ok, Answer} ->
+ gen_tcp:close(S),
+ case decode_answer(Answer, Id, Verbose) of
+ {ok, _} = OK -> OK;
+ {error, badid} -> {error, servfail};
+ Error -> Error
+ end;
+ Error ->
+ gen_tcp:close(S),
+ ?verbose(Verbose, "TCP server recv error: ~p\n",
+ [Error]),
+ Error
end;
Error ->
gen_tcp:close(S),
- ?verbose(Verbose, "TCP server recv error: ~p\n",
+ ?verbose(Verbose, "TCP server send error: ~p\n",
[Error]),
Error
end;