Chromium Code Reviews| 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..6a28a3a2f33a99e5ba6ec2bce55c326c23e938ad 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). |
|
davidben
2017/01/19 21:56:12
Nit: Probably link to the bug here too, so it's cl
nharper
2017/01/19 22:09:07
Done.
|
| + 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. |