aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/test
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2011-11-28 12:32:10 +0100
committerIngela Anderton Andin <[email protected]>2011-11-28 12:32:10 +0100
commit4fee3925d969a42088af74dd02a791bb8e27fd9b (patch)
treeac4d183008552399237791ec6775e6da4697cd68 /lib/ssl/test
parent2476bd42354b28a795a2b66401ca448d4f2b4ba0 (diff)
parent3fa6cba1cf509fbfc3ebbdd5bdb6ead153e5633b (diff)
downloadotp-4fee3925d969a42088af74dd02a791bb8e27fd9b.tar.gz
otp-4fee3925d969a42088af74dd02a791bb8e27fd9b.tar.bz2
otp-4fee3925d969a42088af74dd02a791bb8e27fd9b.zip
Merge branch 'ia/ssl/tcp-error-handling/OTP-9734'
* ia/ssl/tcp-error-handling/OTP-9734: Send ssl_closed notification to active ssl user when a tcp error occurs
Diffstat (limited to 'lib/ssl/test')
-rw-r--r--lib/ssl/test/ssl_basic_SUITE.erl39
-rw-r--r--lib/ssl/test/ssl_session_cache_SUITE.erl9
-rw-r--r--lib/ssl/test/ssl_test_lib.erl8
3 files changed, 46 insertions, 10 deletions
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl
index 21a9cd3bdb..fc56ceb17e 100644
--- a/lib/ssl/test/ssl_basic_SUITE.erl
+++ b/lib/ssl/test/ssl_basic_SUITE.erl
@@ -257,7 +257,8 @@ all() ->
%%different_ca_peer_sign,
no_reuses_session_server_restart_new_cert,
no_reuses_session_server_restart_new_cert_file, reuseaddr,
- hibernate, connect_twice, renegotiate_dos_mitigate
+ hibernate, connect_twice, renegotiate_dos_mitigate,
+ tcp_error_propagation_in_active_mode
].
groups() ->
@@ -3722,7 +3723,35 @@ renegotiate_dos_mitigate(Config) when is_list(Config) ->
ssl_test_lib:close(Server),
ssl_test_lib:close(Client).
-
+tcp_error_propagation_in_active_mode(doc) ->
+ ["Test that process recives {ssl_error, Socket, closed} when tcp error ocurres"];
+tcp_error_propagation_in_active_mode(Config) when is_list(Config) ->
+ ClientOpts = ?config(client_opts, Config),
+ ServerOpts = ?config(server_opts, Config),
+
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+
+ Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {ssl_test_lib, no_result, []}},
+ {options, ServerOpts}]),
+ Port = ssl_test_lib:inet_port(Server),
+ {Client, #sslsocket{pid=Pid} = SslSocket} = ssl_test_lib:start_client([return_socket,
+ {node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, self()},
+ {mfa, {?MODULE, receive_msg, []}},
+ {options, ClientOpts}]),
+
+ {status, _, _, StatusInfo} = sys:get_status(Pid),
+ [_, _,_, _, Prop] = StatusInfo,
+ State = ssl_test_lib:state(Prop),
+ Socket = element(10, State),
+
+ %% Fake tcp error
+ Pid ! {tcp_error, Socket, etimedout},
+
+ ssl_test_lib:check_result(Client, {ssl_closed, SslSocket}).
%%--------------------------------------------------------------------
%%% Internal functions
@@ -3977,3 +4006,9 @@ erlang_ssl_receive(Socket, Data) ->
after ?SLEEP * 3 ->
test_server:fail({did_not_get, Data})
end.
+
+receive_msg(_) ->
+ receive
+ Msg ->
+ Msg
+ end.
diff --git a/lib/ssl/test/ssl_session_cache_SUITE.erl b/lib/ssl/test/ssl_session_cache_SUITE.erl
index 8cdfdec2ce..9c4a5ce640 100644
--- a/lib/ssl/test/ssl_session_cache_SUITE.erl
+++ b/lib/ssl/test/ssl_session_cache_SUITE.erl
@@ -210,7 +210,7 @@ session_cleanup(Config)when is_list(Config) ->
{status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)),
[_, _,_, _, Prop] = StatusInfo,
- State = state(Prop),
+ State = ssl_test_lib:state(Prop),
Cache = element(2, State),
SessionTimer = element(6, State),
@@ -238,11 +238,6 @@ session_cleanup(Config)when is_list(Config) ->
ssl_test_lib:close(Server),
ssl_test_lib:close(Client).
-state([{data,[{"State", State}]} | _]) ->
- State;
-state([_ | Rest]) ->
- state(Rest).
-
check_timer(Timer) ->
case erlang:read_timer(Timer) of
false ->
@@ -256,7 +251,7 @@ check_timer(Timer) ->
get_delay_timer() ->
{status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)),
[_, _,_, _, Prop] = StatusInfo,
- State = state(Prop),
+ State = ssl_test_lib:state(Prop),
case element(7, State) of
undefined ->
test_server:sleep(?SLEEP),
diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl
index 019ea61f37..e0a16fc04a 100644
--- a/lib/ssl/test/ssl_test_lib.erl
+++ b/lib/ssl/test/ssl_test_lib.erl
@@ -691,7 +691,6 @@ public_key(#'PrivateKeyInfo'{privateKeyAlgorithm =
public_key(Key) ->
Key.
-
receive_rizzo_duong_beast() ->
receive
{ssl, _, "ello\n"} ->
@@ -703,3 +702,10 @@ receive_rizzo_duong_beast() ->
end
end
end.
+
+state([{data,[{"State", State}]} | _]) ->
+ State;
+state([{data,[{"StateData", State}]} | _]) ->
+ State;
+state([_ | Rest]) ->
+ state(Rest).