diff options
author | Kozlov Yakov <[email protected]> | 2017-09-01 11:27:31 +0300 |
---|---|---|
committer | Kozlov Yakov <[email protected]> | 2017-09-13 21:48:30 +0300 |
commit | 53e83c1ee2c7d6a95512162b31f72ea2442a836e (patch) | |
tree | 0716b7ade52ecce395062a505be6bedf00e13e58 /lib/kernel/src | |
parent | 50525f3f4e4d6a094d08be91bb5fe1eb5094333d (diff) | |
download | otp-53e83c1ee2c7d6a95512162b31f72ea2442a836e.tar.gz otp-53e83c1ee2c7d6a95512162b31f72ea2442a836e.tar.bz2 otp-53e83c1ee2c7d6a95512162b31f72ea2442a836e.zip |
Fixed dns lookup in case of server close connection with econnrefused
Diffstat (limited to 'lib/kernel/src')
-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 |