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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 169643006: Use sockets with unread data if they've never been used before. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mmenke comments Created 6 years, 9 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_openssl.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f97c4697cfe6fb30e8801a9193afc51d5e6fca30..0c6171858eeb3a37c73709813417e451190758dc 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -487,6 +487,7 @@ SSLClientSocketOpenSSL::SSLClientSocketOpenSSL(
transport_write_error_(OK),
server_cert_chain_(new PeerCertificateChain(NULL)),
completed_handshake_(false),
+ was_ever_used_(false),
client_auth_cert_needed_(false),
cert_verifier_(context.cert_verifier),
server_bound_cert_service_(context.server_bound_cert_service),
@@ -675,11 +676,7 @@ void SSLClientSocketOpenSSL::SetOmniboxSpeculation() {
}
bool SSLClientSocketOpenSSL::WasEverUsed() const {
- if (transport_.get() && transport_->socket())
- return transport_->socket()->WasEverUsed();
-
- NOTREACHED();
- return false;
+ return was_ever_used_;
}
bool SSLClientSocketOpenSSL::UsingTCPFastOpen() const {
@@ -750,6 +747,8 @@ int SSLClientSocketOpenSSL::Read(IOBuffer* buf,
if (rv == ERR_IO_PENDING) {
user_read_callback_ = callback;
} else {
+ if (rv > 0)
+ was_ever_used_ = true;
user_read_buf_ = NULL;
user_read_buf_len_ = 0;
}
@@ -768,6 +767,8 @@ int SSLClientSocketOpenSSL::Write(IOBuffer* buf,
if (rv == ERR_IO_PENDING) {
user_write_callback_ = callback;
} else {
+ if (rv > 0)
+ was_ever_used_ = true;
user_write_buf_ = NULL;
user_write_buf_len_ = 0;
}
@@ -907,6 +908,8 @@ bool SSLClientSocketOpenSSL::Init() {
void SSLClientSocketOpenSSL::DoReadCallback(int rv) {
// Since Run may result in Read being called, clear |user_read_callback_|
// up front.
+ if (rv > 0)
+ was_ever_used_ = true;
user_read_buf_ = NULL;
user_read_buf_len_ = 0;
base::ResetAndReturn(&user_read_callback_).Run(rv);
@@ -915,6 +918,8 @@ void SSLClientSocketOpenSSL::DoReadCallback(int rv) {
void SSLClientSocketOpenSSL::DoWriteCallback(int rv) {
// Since Run may result in Write being called, clear |user_write_callback_|
// up front.
+ if (rv > 0)
+ was_ever_used_ = true;
user_write_buf_ = NULL;
user_write_buf_len_ = 0;
base::ResetAndReturn(&user_write_callback_).Run(rv);
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698