aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2011-12-06 11:32:35 +0100
committerIngela Anderton Andin <[email protected]>2011-12-06 11:32:35 +0100
commitbecb65f433c26133a519e367540a25d1036010b6 (patch)
treefb945b1eb81b3bc85a93d6dd821634fd9a89194d /lib/ssl/src
parent026a7c04fdf7add071ee61b1ac24a5ebbcbb73db (diff)
downloadotp-becb65f433c26133a519e367540a25d1036010b6.tar.gz
otp-becb65f433c26133a519e367540a25d1036010b6.tar.bz2
otp-becb65f433c26133a519e367540a25d1036010b6.zip
Improve ssl session cleanup test
Check last delay timer for both client and server side to avoide timing issues.
Diffstat (limited to 'lib/ssl/src')
-rw-r--r--lib/ssl/src/ssl_manager.erl11
1 files changed, 8 insertions, 3 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}.