aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2011-12-07 11:35:11 +0100
committerIngela Anderton Andin <[email protected]>2011-12-07 11:35:11 +0100
commitcdb2c77194bf54007c7bb069d9ac2d334cc177ab (patch)
tree6c269135236e6301bac1803049a2ef5fa5cef41d /lib/ssl
parenta1f72ad056cbec4cd69ff4ef0e9c2cc744361eac (diff)
parentbecb65f433c26133a519e367540a25d1036010b6 (diff)
downloadotp-cdb2c77194bf54007c7bb069d9ac2d334cc177ab.tar.gz
otp-cdb2c77194bf54007c7bb069d9ac2d334cc177ab.tar.bz2
otp-cdb2c77194bf54007c7bb069d9ac2d334cc177ab.zip
Merge branch 'ia/ssl/session/cleanup-test'
* ia/ssl/session/cleanup-test: Improve ssl session cleanup test
Diffstat (limited to 'lib/ssl')
-rw-r--r--lib/ssl/src/ssl_manager.erl11
-rw-r--r--lib/ssl/test/ssl_session_cache_SUITE.erl21
2 files changed, 22 insertions, 10 deletions
diff --git a/lib/ssl/src/ssl_manager.erl b/lib/ssl/src/ssl_manager.erl
index 6a44ef8c3e..6389ff03f5 100644
--- a/lib/ssl/src/ssl_manager.erl
+++ b/lib/ssl/src/ssl_manager.erl
@@ -51,7 +51,7 @@
session_lifetime,
certificate_db,
session_validation_timer,
- last_delay_timer %% Keep for testing purposes
+ last_delay_timer = {undefined, undefined}%% Keep for testing purposes
}).
-define('24H_in_msec', 8640000).
@@ -427,7 +427,7 @@ delay_time() ->
?CLEAN_SESSION_DB
end.
-invalidate_session(Cache, CacheCb, Key, Session, State) ->
+invalidate_session(Cache, CacheCb, Key, Session, #state{last_delay_timer = LastTimer} = State) ->
case CacheCb:lookup(Cache, Key) of
undefined -> %% Session is already invalidated
{noreply, State};
@@ -441,5 +441,10 @@ invalidate_session(Cache, CacheCb, Key, Session, State) ->
CacheCb:update(Cache, Key, Session#session{is_resumable = false}),
TRef =
erlang:send_after(delay_time(), self(), {delayed_clean_session, Key}),
- {noreply, State#state{last_delay_timer = TRef}}
+ {noreply, State#state{last_delay_timer = last_delay_timer(Key, TRef, LastTimer)}}
end.
+
+last_delay_timer({{_,_},_}, TRef, {LastServer, _}) ->
+ {LastServer, TRef};
+last_delay_timer({_,_}, TRef, {_, LastClient}) ->
+ {TRef, LastClient}.
diff --git a/lib/ssl/test/ssl_session_cache_SUITE.erl b/lib/ssl/test/ssl_session_cache_SUITE.erl
index 7f782233ef..491aa893c2 100644
--- a/lib/ssl/test/ssl_session_cache_SUITE.erl
+++ b/lib/ssl/test/ssl_session_cache_SUITE.erl
@@ -225,9 +225,10 @@ session_cleanup(Config)when is_list(Config) ->
check_timer(SessionTimer),
test_server:sleep(?DELAY *2), %% Delay time + some extra time
- DelayTimer = get_delay_timer(),
+ {ServerDelayTimer, ClientDelayTimer} = get_delay_timers(),
- check_timer(DelayTimer),
+ check_timer(ServerDelayTimer),
+ check_timer(ClientDelayTimer),
test_server:sleep(?SLEEP), %% Make sure clean has had time to run
@@ -250,16 +251,22 @@ check_timer(Timer) ->
check_timer(Timer)
end.
-get_delay_timer() ->
+get_delay_timers() ->
{status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)),
[_, _,_, _, Prop] = StatusInfo,
State = ssl_test_lib:state(Prop),
case element(7, State) of
- undefined ->
+ {undefined, undefined} ->
+ test_server:sleep(?SLEEP),
+ get_delay_timers();
+ {undefined, _} ->
+ test_server:sleep(?SLEEP),
+ get_delay_timers();
+ {_, undefined} ->
test_server:sleep(?SLEEP),
- get_delay_timer();
- DelayTimer ->
- DelayTimer
+ get_delay_timers();
+ DelayTimers ->
+ DelayTimers
end.
%%--------------------------------------------------------------------
session_cache_process_list(doc) ->