diff options
author | Raimo Niskanen <[email protected]> | 2017-09-19 14:43:47 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-09-19 14:43:47 +0200 |
commit | 6d11362936408091aa7108c252f2f7bf20cdc327 (patch) | |
tree | 2938b3ccd69cd822e1981f244a2a5a644488f93e /lib/kernel | |
parent | 9bace0e62d528822519de33c9cd54030181e8541 (diff) | |
parent | 53e83c1ee2c7d6a95512162b31f72ea2442a836e (diff) | |
download | otp-6d11362936408091aa7108c252f2f7bf20cdc327.tar.gz otp-6d11362936408091aa7108c252f2f7bf20cdc327.tar.bz2 otp-6d11362936408091aa7108c252f2f7bf20cdc327.zip |
Merge pull request #1557 from egobrain/000-fix-dns-lookup
OTP-13133
Fixed dns lookup in case of server close connection with econnrefused
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/src/inet_res.erl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl index 90e49ddfdf..49aa5f8bda 100644 --- a/lib/kernel/src/inet_res.erl +++ b/lib/kernel/src/inet_res.erl @@ -859,15 +859,17 @@ query_ns(S0, Id, Buffer, IP, Port, Timer, Retry, I, {ok,S} -> Timeout = inet:timeout( (Tm * (1 bsl I)) div Retry, Timer), - {S, case query_udp( S, Id, Buffer, IP, Port, Timeout, Verbose) of {ok,#dns_rec{header=H}} when H#dns_header.tc -> TcpTimeout = inet:timeout(Tm*5, Timer), - query_tcp( - TcpTimeout, Id, Buffer, IP, Port, Verbose); - Reply -> Reply - end}; + {S, query_tcp( + TcpTimeout, Id, Buffer, IP, Port, Verbose)}; + {error, econnrefused} = Err -> + ok = udp_close(S), + {#sock{}, Err}; + Reply -> {S, Reply} + end; Error -> {S0,Error} end |