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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 1089123003: Don't check for unflushed bytes in SSLClientSocketOpenSSL::IsConnectedAndIdle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak the test slight Created 5 years, 8 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 | « no previous file | 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 9103a932b1b11e8e7fa59bf3397660934bb34487..e36534cc68a68b732e840adba750a5a120c83bbd 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -539,12 +539,16 @@ bool SSLClientSocketOpenSSL::IsConnectedAndIdle() const {
// If an asynchronous operation is still pending.
if (user_read_buf_.get() || user_write_buf_.get())
return false;
- // If there is data waiting to be sent, or data read from the network that
- // has not yet been consumed.
- if (BIO_pending(transport_bio_) > 0 ||
- BIO_wpending(transport_bio_) > 0) {
+
+ // If there is data read from the network that has not yet been consumed, do
+ // not treat the connection as idle.
+ //
+ // Note that this does not check |BIO_pending|, whether there is ciphertext
+ // that has not yet been flushed to the network. |Write| returns early, so
+ // this can cause race conditions which cause a socket to not be treated
+ // reusable when it should be. See https://crbug.com/466147.
+ if (BIO_wpending(transport_bio_) > 0)
return false;
- }
return transport_->socket()->IsConnectedAndIdle();
}
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698