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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 384873002: This CL changes the lifespan of SSLConnectJobMessengers so that they are created only when needed, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@useloop
Patch Set: Rebase, fixed issue where messenger field wasn't set to NULL after deletion Created 6 years, 4 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
Index: net/socket/ssl_client_socket_openssl.cc
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index 89cb40592952b387939d39c8ea21938f96c2bd2f..cb03d83cd0abeff07398ba7af3439c2875ad67ac 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -374,6 +374,15 @@ SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() {
Disconnect();
}
+// Compute a unique key string for the SSL session cache.
+// Return a string.
wtc 2014/08/12 14:51:01 I remember I asked you to revise this comment befo
mshelley 2014/08/12 21:47:01 Done.
+std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const {
+ std::string result = host_and_port_.ToString();
+ result.append("/");
+ result.append(ssl_session_cache_shard_);
+ return result;
+}
+
bool SSLClientSocketOpenSSL::InSessionCache() const {
SSLContext* context = SSLContext::GetInstance();
std::string cache_key = GetSessionCacheKey();
@@ -639,8 +648,13 @@ int SSLClientSocketOpenSSL::Read(IOBuffer* buf,
if (rv == ERR_IO_PENDING) {
user_read_callback_ = callback;
} else {
- if (rv > 0)
+ if (rv > 0) {
was_ever_used_ = true;
+ } else if (rv < 0) {
+ // Failure of a read attempt may indicate a failed false start
+ // connection.
+ OnHandshakeCompletion();
+ }
Ryan Sleevi 2014/08/12 00:27:42 This should be / is a separate CL, right?
wtc 2014/08/12 14:51:00 This is a merge error. The current code is on line
mshelley 2014/08/12 21:47:01 Done.
user_read_buf_ = NULL;
user_read_buf_len_ = 0;
if (rv <= 0) {
@@ -664,8 +678,13 @@ int SSLClientSocketOpenSSL::Write(IOBuffer* buf,
if (rv == ERR_IO_PENDING) {
user_write_callback_ = callback;
} else {
- if (rv > 0)
+ if (rv > 0) {
was_ever_used_ = true;
+ } else {
+ // Failure of a write attempt may indicate a failed false start
+ // connection.
+ OnHandshakeCompletion();
+ }
wtc 2014/08/12 14:51:01 Please undo this change.
mshelley 2014/08/12 21:47:01 Done.
user_write_buf_ = NULL;
user_write_buf_len_ = 0;
if (rv < 0) {
@@ -845,10 +864,6 @@ void SSLClientSocketOpenSSL::DoWriteCallback(int rv) {
base::ResetAndReturn(&user_write_callback_).Run(rv);
}
-std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const {
- return CreateSessionCacheKey(host_and_port_, ssl_session_cache_shard_);
-}
-
void SSLClientSocketOpenSSL::OnHandshakeCompletion() {
if (!handshake_completion_callback_.is_null())
base::ResetAndReturn(&handshake_completion_callback_).Run();
@@ -1079,7 +1094,6 @@ X509Certificate* SSLClientSocketOpenSSL::UpdateServerCert() {
if (!server_cert_chain_->IsValid())
DVLOG(1) << "UpdateServerCert received invalid certificate chain from peer";
-
wtc 2014/08/12 14:51:01 This is probably a merge error. I seem to remember
return server_cert_.get();
}

Powered by Google App Engine
This is Rietveld 408576698