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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 7399025: Fix instability in SSL client/server sockets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update FakeSocketTest. Created 9 years, 5 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_server_socket_nss.cc » ('j') | net/socket/ssl_server_socket_nss.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 e827f398db65eb56a946e5c1ed286f455ccccb12..e1a654577e5c5ecb31ae55685bdf34b52fbfda33 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -1734,15 +1734,26 @@ void SSLClientSocketNSS::UncorkAfterTimeout() {
} while (nsent > 0);
}
-// Do network I/O between the given buffer and the given socket.
-// Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING)
+// Do as much as possible network I/O between the buffer and the
+// transport socket. Return true if some I/O performed, false
+// otherwise (error or ERR_IO_PENDING).
bool SSLClientSocketNSS::DoTransportIO() {
EnterFunction("");
bool network_moved = false;
if (nss_bufs_ != NULL) {
- int nsent = BufferSend();
- int nreceived = BufferRecv();
- network_moved = (nsent > 0 || nreceived >= 0);
+ int rv;
+ // Read and write as much data as we can. Loops are neccessary
+ // because Read() and Write() may return synchronously.
+ do {
+ rv = BufferSend();
+ if (rv > 0)
+ network_moved = true;
+ } while (rv > 0);
+ do {
+ rv = BufferRecv();
+ if (rv >= 0)
+ network_moved = true;
+ } while (rv > 0);
}
LeaveFunction(network_moved);
return network_moved;
« no previous file with comments | « no previous file | net/socket/ssl_server_socket_nss.cc » ('j') | net/socket/ssl_server_socket_nss.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698