diff options
author | lloyd <[email protected]> | 2012-02-20 18:33:49 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-02-20 18:33:49 +0000 |
commit | 7fb2de6b49d8bf42ede7b4dfda7c358bb67e5c9f (patch) | |
tree | 32319c62e13572276b52c467e4c53d4646de6cc9 /src/tls/tls_session_manager.h | |
parent | 8c2dc1a6c3bf352a56622d569dc855ca8d6ab5e0 (diff) |
Merge fixups. Add locking to default session manager. Use chrono lib
and unique_ptr.
Diffstat (limited to 'src/tls/tls_session_manager.h')
-rw-r--r-- | src/tls/tls_session_manager.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/tls/tls_session_manager.h b/src/tls/tls_session_manager.h index c25fecac4..4152f2392 100644 --- a/src/tls/tls_session_manager.h +++ b/src/tls/tls_session_manager.h @@ -9,6 +9,8 @@ #define TLS_SESSION_MANAGER_H__ #include <botan/tls_session.h> +#include <mutex> +#include <chrono> #include <map> namespace Botan { @@ -69,8 +71,6 @@ class BOTAN_DLL Session_Manager /** * A simple implementation of Session_Manager that just saves * values in memory, with no persistance abilities -* -* @todo add locking */ class BOTAN_DLL Session_Manager_In_Memory : public Session_Manager { @@ -82,7 +82,7 @@ class BOTAN_DLL Session_Manager_In_Memory : public Session_Manager * seconds have elapsed from initial handshake. */ Session_Manager_In_Memory(size_t max_sessions = 1000, - size_t session_lifetime = 7200) : + std::chrono::seconds session_lifetime = std::chrono::seconds(7200)) : max_sessions(max_sessions), session_lifetime(session_lifetime) {} @@ -101,7 +101,10 @@ class BOTAN_DLL Session_Manager_In_Memory : public Session_Manager bool load_from_session_str(const std::string& session_str, Session& session); - size_t max_sessions, session_lifetime; + std::mutex mutex; + + size_t max_sessions; + std::chrono::seconds session_lifetime; std::map<std::string, Session> sessions; // hex(session_id) -> session std::map<std::string, std::string> host_sessions; |