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

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: Fix similar issue in OnSendComplete() 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..52e588b104c8c21bd682c97efc894e9dfd0bc8b2 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -1188,14 +1188,12 @@ void SSLClientSocketNSS::OnSendComplete(int result) {
int rv_write = ERR_IO_PENDING;
bool network_moved;
do {
- if (user_read_buf_)
+ if (user_read_buf_ && rv_read == ERR_IO_PENDING)
rv_read = DoPayloadRead();
- if (user_write_buf_)
+ if (user_write_buf_ && rv_write == ERR_IO_PENDING)
rv_write = DoPayloadWrite();
network_moved = DoTransportIO();
- } while (rv_read == ERR_IO_PENDING &&
- rv_write == ERR_IO_PENDING &&
- network_moved);
+ } while (network_moved);
Wez 2011/07/18 21:53:33 This loop used to exit on error, or if one or othe
Sergey Ulanov 2011/07/19 19:26:56 Actually the code below may crash even when only D
wtc 2011/07/21 00:42:30 Wez, you are right on. I recently noticed this pr
if (user_read_buf_ && rv_read != ERR_IO_PENDING)
DoReadCallback(rv_read);
@@ -1317,11 +1315,12 @@ int SSLClientSocketNSS::DoWriteLoop(int result) {
}
bool network_moved;
- int rv;
+ int rv = ERR_IO_PENDING;
do {
- rv = DoPayloadWrite();
+ if (rv == ERR_IO_PENDING)
+ rv = DoPayloadWrite();
network_moved = DoTransportIO();
- } while (rv == ERR_IO_PENDING && network_moved);
+ } while (network_moved);
Wez 2011/07/18 21:53:33 This will continue to loop on PR_Write() errors.
Sergey Ulanov 2011/07/19 19:26:56 Why can't we continue pushing data to the transpor
LeaveFunction("");
return rv;
@@ -1742,7 +1741,7 @@ bool SSLClientSocketNSS::DoTransportIO() {
if (nss_bufs_ != NULL) {
int nsent = BufferSend();
int nreceived = BufferRecv();
- network_moved = (nsent > 0 || nreceived >= 0);
Wez 2011/07/18 21:53:33 A zero return value from the underlying net::Socke
Sergey Ulanov 2011/07/19 19:26:56 The previous behavior may be counter-intuitive dep
+ network_moved = (nsent > 0 || nreceived > 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