Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1495)

Unified Diff: net/socket/ssl_client_socket_impl.cc

Issue 2625883002: SSLClientSessionCache: Log number of times Lookup is called per Session. (Closed)
Patch Set: reply to comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/ssl_client_socket_impl.h ('k') | net/ssl/ssl_client_session_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_impl.cc
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc
index 6fd3c363ef0b82b6d8d66bfd29fea651c99b9cba..b3f86a83c8b9593cd37a9b0eac9fd99620a265e4 100644
--- a/net/socket/ssl_client_socket_impl.cc
+++ b/net/socket/ssl_client_socket_impl.cc
@@ -945,8 +945,8 @@ int SSLClientSocketImpl::Init() {
return ERR_UNEXPECTED;
}
- bssl::UniquePtr<SSL_SESSION> session =
- context->session_cache()->Lookup(GetSessionCacheKey());
+ bssl::UniquePtr<SSL_SESSION> session = context->session_cache()->Lookup(
+ GetSessionCacheKey(), &ssl_session_cache_lookup_count_);
if (session)
SSL_set_session(ssl_.get(), session.get());
@@ -1147,6 +1147,19 @@ int SSLClientSocketImpl::DoHandshakeComplete(int result) {
if (result < 0)
return result;
+ SSLContext::GetInstance()->session_cache()->ResetLookupCount(
+ GetSessionCacheKey());
+ // If we got a session from the session cache, log how many concurrent
+ // handshakes that session was used in before we finished our handshake. This
+ // is only recorded if the session from the cache was actually used, and only
+ // if the ALPN protocol is h2 (under the assumption that TLS 1.3 servers will
+ // be speaking h2). See https://crbug.com/631988.
+ if (ssl_session_cache_lookup_count_ && negotiated_protocol_ == kProtoHTTP2 &&
+ SSL_session_reused(ssl_.get())) {
+ UMA_HISTOGRAM_EXACT_LINEAR("Net.SSLSessionConcurrentLookupCount",
+ ssl_session_cache_lookup_count_, 20);
+ }
+
// DHE is offered on the deprecated cipher fallback and then rejected
// afterwards. This is to aid in diagnosing connection failures because a
// server requires DHE ciphers.
« no previous file with comments | « net/socket/ssl_client_socket_impl.h ('k') | net/ssl/ssl_client_session_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698