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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 9172005: The network_moved check in DoHandshakeLoop should only apply to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Don't use continue in the do-while loop Created 8 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_nss.cc
===================================================================
--- net/socket/ssl_client_socket_nss.cc (revision 116742)
+++ net/socket/ssl_client_socket_nss.cc (working copy)
@@ -1258,7 +1258,6 @@
int SSLClientSocketNSS::DoHandshakeLoop(int last_io_result) {
EnterFunction(last_io_result);
- bool network_moved;
int rv = last_io_result;
do {
// Default to STATE_NONE for next state.
@@ -1269,10 +1268,8 @@
State state = next_handshake_state_;
GotoState(STATE_NONE);
switch (state) {
- case STATE_NONE:
- // we're just pumping data between the buffer and the network
- break;
case STATE_LOAD_SSL_HOST_INFO:
+ DCHECK(rv == OK || rv == ERR_IO_PENDING);
rv = DoLoadSSLHostInfo();
break;
case STATE_HANDSHAKE:
@@ -1291,6 +1288,7 @@
case STATE_VERIFY_CERT_COMPLETE:
rv = DoVerifyCertComplete(rv);
break;
+ case STATE_NONE:
default:
rv = ERR_UNEXPECTED;
LOG(DFATAL) << "unexpected state " << state;
@@ -1298,9 +1296,15 @@
}
// Do the actual network I/O
- network_moved = DoTransportIO();
- } while ((rv != ERR_IO_PENDING || network_moved) &&
- next_handshake_state_ != STATE_NONE);
+ bool network_moved = DoTransportIO();
+ if (network_moved && next_handshake_state_ == STATE_HANDSHAKE) {
+ // In general we exit the loop if rv is ERR_IO_PENDING. In this
+ // special case we keep looping even if rv is ERR_IO_PENDING because
+ // the transport IO may allow DoHandshake to make progress.
+ DCHECK(rv == OK || rv == ERR_IO_PENDING);
+ rv = OK; // This causes us to stay in the loop.
+ }
+ } while (rv != ERR_IO_PENDING && next_handshake_state_ != STATE_NONE);
LeaveFunction("");
return rv;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698