aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/ssl_session.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2015-12-07 10:35:19 +0100
committerIngela Anderton Andin <[email protected]>2015-12-07 10:35:19 +0100
commitf258633921e7dd0bd5760281d2a26a0f937e53c4 (patch)
tree8c6e16902035cbf583c1325c84bfb8f2b118f8cc /lib/ssl/src/ssl_session.erl
parent1d1677c2a85ebce0ada828d254c7a1122b825e0a (diff)
parent55569124ac815eedc21c234c447e346b97f3c8fe (diff)
downloadotp-f258633921e7dd0bd5760281d2a26a0f937e53c4.tar.gz
otp-f258633921e7dd0bd5760281d2a26a0f937e53c4.tar.bz2
otp-f258633921e7dd0bd5760281d2a26a0f937e53c4.zip
Merge branch 'ia/ssl/max-sessions/OTP-12392' into maint
* ia/ssl/max-sessions/OTP-12392: ssl: Fix documentation mistakes ssl: Add upper limit for session cache ssl: Measure elapsed time with erlang:monotonic_time
Diffstat (limited to 'lib/ssl/src/ssl_session.erl')
-rw-r--r--lib/ssl/src/ssl_session.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/ssl/src/ssl_session.erl b/lib/ssl/src/ssl_session.erl
index 1849a05314..2b24bff5ff 100644
--- a/lib/ssl/src/ssl_session.erl
+++ b/lib/ssl/src/ssl_session.erl
@@ -61,13 +61,16 @@ client_id(ClientInfo, Cache, CacheCb, OwnCert) ->
SessionId
end.
--spec valid_session(#session{}, seconds()) -> boolean().
+-spec valid_session(#session{}, seconds() | {invalidate_before, integer()}) -> boolean().
%%
%% Description: Check that the session has not expired
%%--------------------------------------------------------------------
+valid_session(#session{time_stamp = TimeStamp}, {invalidate_before, Before}) ->
+ TimeStamp > Before;
valid_session(#session{time_stamp = TimeStamp}, LifeTime) ->
- Now = calendar:datetime_to_gregorian_seconds({date(), time()}),
- Now - TimeStamp < LifeTime.
+ Now = erlang:monotonic_time(),
+ Lived = erlang:convert_time_unit(Now-TimeStamp, native, seconds),
+ Lived < LifeTime.
server_id(Port, <<>>, _SslOpts, _Cert, _, _) ->
{ssl_manager:new_session_id(Port), undefined};