aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test/inets_test_lib.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-07-18 12:52:57 +0200
committerMicael Karlberg <[email protected]>2012-07-18 12:52:57 +0200
commit84f2859757a7fbf3d1280648f995e0a7d0e0754b (patch)
treeb42b1866d6c04d1cb2315e2d750bcc20cdd9066b /lib/inets/test/inets_test_lib.erl
parent57958e49b0fe80e1fe96bab6fd0d2da196ac5584 (diff)
downloadotp-84f2859757a7fbf3d1280648f995e0a7d0e0754b.tar.gz
otp-84f2859757a7fbf3d1280648f995e0a7d0e0754b.tar.bz2
otp-84f2859757a7fbf3d1280648f995e0a7d0e0754b.zip
Add error reason ehostunreach when trying with IPv4
If a IPv6 (inet6) connect fails, we try to connect with IPv4 (inet) again. Added error reason ehostunreach for which it is ok to try again (with IPv4).
Diffstat (limited to 'lib/inets/test/inets_test_lib.erl')
-rw-r--r--lib/inets/test/inets_test_lib.erl28
1 files changed, 9 insertions, 19 deletions
diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl
index 7f4b0ec8d8..4ec8a6002f 100644
--- a/lib/inets/test/inets_test_lib.erl
+++ b/lib/inets/test/inets_test_lib.erl
@@ -536,25 +536,15 @@ connect(ip_comm, Host, Port, Opts, Type) ->
tsp("connect success"),
{ok, Socket};
- {error, nxdomain} when Type =:= inet6 ->
- tsp("connect error nxdomain when"
- "~n Opts: ~p", [Opts]),
- connect(ip_comm, Host, Port, Opts -- [inet6], inet);
- {error, eafnosupport} when Type =:= inet6 ->
- tsp("connect error eafnosupport when"
- "~n Opts: ~p", [Opts]),
- connect(ip_comm, Host, Port, Opts -- [inet6], inet);
- {error, econnreset} when Type =:= inet6 ->
- tsp("connect error econnreset when"
- "~n Opts: ~p", [Opts]),
- connect(ip_comm, Host, Port, Opts -- [inet6], inet);
- {error, enetunreach} when Type =:= inet6 ->
- tsp("connect error eafnosupport when"
- "~n Opts: ~p", [Opts]),
- connect(ip_comm, Host, Port, Opts -- [inet6], inet);
- {error, econnrefused} when Type =:= inet6 ->
- tsp("connect error econnrefused when"
- "~n Opts: ~p", [Opts]),
+ {error, Reason} when ((Type =:= inet6) andalso
+ ((Reason =:= nxdomain) orelse
+ (Reason =:= eafnosupport) orelse
+ (Reason =:= econnreset) orelse
+ (Reason =:= enetunreach) orelse
+ (Reason =:= econnrefused) orelse
+ (Reason =:= ehostunreach))) ->
+ tsp("connect error ~w when"
+ "~n Opts: ~p", [Reason, Opts]),
connect(ip_comm, Host, Port, Opts -- [inet6], inet);
Error ->