From 84f2859757a7fbf3d1280648f995e0a7d0e0754b Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 18 Jul 2012 12:52:57 +0200 Subject: 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). --- lib/inets/test/inets_test_lib.erl | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'lib') 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 -> -- cgit v1.2.3