diff options
Diffstat (limited to 'lib/ssl/test/ssl_basic_SUITE.erl')
-rw-r--r-- | lib/ssl/test/ssl_basic_SUITE.erl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index d46857d21e..db306419aa 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -785,7 +785,8 @@ user_dies(Config) when is_list(Config) -> {ok, L} = ssl:listen(Port, ServerOpts), loop(L) end), - {ok, _} = ssl:connect(Hostname, Port, ClientOpts), + do_wait_tls_server(Hostname, Port), + {ok,_} = ssl:connect(Hostname, Port, ClientOpts), check_process_count(2), Pid = spawn_link(fun() -> many_client_starter(Hostname, Port, ClientOpts, Server) end), receive @@ -1030,3 +1031,18 @@ check_process_count(Count, Try) -> ct:sleep(500), %% Wait long enough check_process_count(Count, Try - 1) end. + +do_wait_tls_server(Hostname, Port) -> + do_wait_tls_server(Hostname, Port, 5). + +do_wait_tls_server(_,_, 0)-> + ct:fail(to_connect_to_server); +do_wait_tls_server(Hostname, Port, Try) -> + case gen_tcp:connect(Hostname, Port, []) of + {ok, S} -> + gen_tcp:close(S), + ok; + _ -> + ct:sleep(?SLEEP), + do_wait_tls_server(Hostname, Port, Try-1) + end. |