summaryrefslogtreecommitdiffstats
path: root/net/socket/ssl_session_cache_openssl.cc
diff options
context:
space:
mode:
authormshelley@chromium.org <mshelley@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 10:07:22 +0000
committermshelley@chromium.org <mshelley@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 10:07:22 +0000
commite4738ba510e41318a47bf5acc19f2bf9bfc77c37 (patch)
tree10be6dddc06fa4b0dcf95f25a3ee537461c14f0e /net/socket/ssl_session_cache_openssl.cc
parent66e53d02894643f405f9981681b3b15a59d9075e (diff)
downloadchromium_src-e4738ba510e41318a47bf5acc19f2bf9bfc77c37.zip
chromium_src-e4738ba510e41318a47bf5acc19f2bf9bfc77c37.tar.gz
chromium_src-e4738ba510e41318a47bf5acc19f2bf9bfc77c37.tar.bz2
This CL corrects a bug in which the OnHandshakeComplete callback for an ssl session was never
called if that session had an empty session id (i.e. the session wasn't added to the cache). This CL sets the OpenSSL info_callback such that CheckIfSessionAdded will be run whenever an OpenSSL session has finished its handshake. Previously, CheckIfSessionAdded was called in NewSessionCallbackStatic. NewSessionCallbackStatic is only called when a session is added to the cache. Thus, leading connections with sessions that were not added to the cache would force their pending jobs to wait indefinitely instead of letting the jobs proceed at the completion of the leading job's connection. R=mmenke@chromium.org,rsleevi@chromium.org,wtc@chromium.org, davidben@chromium.org BUG=398967 Review URL: https://codereview.chromium.org/416683002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/ssl_session_cache_openssl.cc')
-rw-r--r--net/socket/ssl_session_cache_openssl.cc56
1 files changed, 0 insertions, 56 deletions
diff --git a/net/socket/ssl_session_cache_openssl.cc b/net/socket/ssl_session_cache_openssl.cc
index 5bb0d16..2c19c60 100644
--- a/net/socket/ssl_session_cache_openssl.cc
+++ b/net/socket/ssl_session_cache_openssl.cc
@@ -253,31 +253,6 @@ class SSLSessionCacheOpenSSLImpl {
return session_is_good;
}
- void SetSessionAddedCallback(SSL* ssl, const base::Closure& callback) {
- // Add |ssl| to the SSLToCallbackMap.
- ssl_to_callback_map_.insert(SSLToCallbackMap::value_type(
- ssl, CallbackAndCompletionCount(callback, 0)));
- }
-
- // Determines if the session for |ssl| is in the cache, and calls the
- // appropriate callback if that is the case.
- //
- // The session must be both MarkedAsGood and Added in order for the
- // callback to be run. These two events can occur in either order.
- void CheckIfSessionFinished(SSL* ssl) {
- SSLToCallbackMap::iterator it = ssl_to_callback_map_.find(ssl);
- if (it == ssl_to_callback_map_.end())
- return;
- // Increment the session's completion count.
- if (++it->second.count == 2) {
- base::Closure callback = it->second.callback;
- ssl_to_callback_map_.erase(it);
- callback.Run();
- }
- }
-
- void RemoveSessionAddedCallback(SSL* ssl) { ssl_to_callback_map_.erase(ssl); }
-
void MarkSSLSessionAsGood(SSL* ssl) {
SSL_SESSION* session = SSL_get_session(ssl);
CHECK(session);
@@ -285,8 +260,6 @@ class SSLSessionCacheOpenSSLImpl {
// Mark the session as good, allowing it to be used for future connections.
SSL_SESSION_set_ex_data(
session, GetSSLSessionExIndex(), reinterpret_cast<void*>(1));
-
- CheckIfSessionFinished(ssl);
}
// Flush all entries from the cache.
@@ -302,30 +275,12 @@ class SSLSessionCacheOpenSSLImpl {
}
private:
- // CallbackAndCompletionCounts are used to group a callback that should be
- // run when a certain sesssion is added to the session cache with an integer
- // indicating the status of that session.
- struct CallbackAndCompletionCount {
- CallbackAndCompletionCount(const base::Closure& completion_callback,
- int completion_count)
- : callback(completion_callback), count(completion_count) {}
-
- const base::Closure callback;
- // |count| < 2 means that the ssl session associated with this object
- // has not been added to the session cache or has not been marked as good.
- // |count| is incremented when a session is added to the cache or marked as
- // good, thus |count| == 2 means that the session is ready for use.
- int count;
- };
-
// Type for list of SSL_SESSION handles, ordered in MRU order.
typedef std::list<SSL_SESSION*> MRUSessionList;
// Type for a dictionary from unique cache keys to session list nodes.
typedef base::hash_map<std::string, MRUSessionList::iterator> KeyIndex;
// Type for a dictionary from SessionId values to key index nodes.
typedef base::hash_map<SessionId, KeyIndex::iterator> SessionIdIndex;
- // Type for a map from SSL* to associated callbacks
- typedef std::map<SSL*, CallbackAndCompletionCount> SSLToCallbackMap;
// Return the key associated with a given session, or the empty string if
// none exist. This shall only be used for debugging.
@@ -405,7 +360,6 @@ class SSLSessionCacheOpenSSLImpl {
static int NewSessionCallbackStatic(SSL* ssl, SSL_SESSION* session) {
SSLSessionCacheOpenSSLImpl* cache = GetCache(ssl->ctx);
cache->OnSessionAdded(ssl, session);
- cache->CheckIfSessionFinished(ssl);
return 1;
}
@@ -529,7 +483,6 @@ class SSLSessionCacheOpenSSLImpl {
SSL_CTX* ctx_;
SSLSessionCacheOpenSSL::Config config_;
- SSLToCallbackMap ssl_to_callback_map_;
// method to get the index which can later be used with SSL_CTX_get_ex_data()
// or SSL_CTX_set_ex_data().
@@ -568,15 +521,6 @@ bool SSLSessionCacheOpenSSL::SSLSessionIsInCache(
return impl_->SSLSessionIsInCache(cache_key);
}
-void SSLSessionCacheOpenSSL::RemoveSessionAddedCallback(SSL* ssl) {
- impl_->RemoveSessionAddedCallback(ssl);
-}
-
-void SSLSessionCacheOpenSSL::SetSessionAddedCallback(SSL* ssl,
- const base::Closure& cb) {
- impl_->SetSessionAddedCallback(ssl, cb);
-}
-
void SSLSessionCacheOpenSSL::MarkSSLSessionAsGood(SSL* ssl) {
return impl_->MarkSSLSessionAsGood(ssl);
}