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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 337823002: Stop attempting to write to transport sockets in NSS on failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: document CountingStreamSocket (try jobs on patch set 1) Created 6 years, 6 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') | net/socket/ssl_client_socket_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_nss.cc
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 3a8b39e678c2785ea4d6fd7c60fea762fb599883..34bdf1b8fb5e120c9a095fb5dec52f2b56ac168f 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -890,6 +890,7 @@ class SSLClientSocketNSS::Core : public base::RefCountedThreadSafe<Core> {
bool transport_recv_busy_;
bool transport_recv_eof_;
bool transport_send_busy_;
+ int transport_send_error_;
// Used by Read function.
scoped_refptr<IOBuffer> user_read_buf_;
@@ -956,6 +957,7 @@ SSLClientSocketNSS::Core::Core(
transport_recv_busy_(false),
transport_recv_eof_(false),
transport_send_busy_(false),
+ transport_send_error_(0),
wtc 2014/06/16 19:57:21 I assume transport_send_error_ is a net:: error co
davidben 2014/06/16 23:02:13 Done.
user_read_buf_len_(0),
user_write_buf_len_(0),
network_task_runner_(network_task_runner),
@@ -2139,6 +2141,8 @@ int SSLClientSocketNSS::Core::BufferSend() {
if (transport_send_busy_)
return ERR_IO_PENDING;
+ if (transport_send_error_ != 0)
+ return transport_send_error_;
Ryan Sleevi 2014/06/16 22:07:07 Why introduce another member, when we already have
davidben 2014/06/16 23:02:13 Good point. That's much cleaner. Done.
const char* buf1;
const char* buf2;
@@ -2704,6 +2708,12 @@ void SSLClientSocketNSS::Core::BufferSendComplete(int result) {
memio_PutWriteResult(nss_bufs_, MapErrorToNSS(result));
transport_send_busy_ = false;
+ // If there was an error, save the result on the NSS task runner. Future calls
+ // to BufferSend will return the error synchronously rather than calling
+ // DoBufferSend on the network task runner. This is important to prevent
+ // spinning infinitely. See https://crbug.com/381160.
wtc 2014/06/16 19:57:21 Nit: it may be better to move this comment (starti
davidben 2014/06/16 23:02:13 Done.
+ if (result < 0)
+ transport_send_error_ = result;
OnSendComplete(result);
}
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_unittest.cc » ('j') | net/socket/ssl_client_socket_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698